计算信息检索评价指标pr的源程序

计算信息检索评价指标pr的源程序

ID:19934665

大小:16.61 KB

页数:5页

时间:2018-10-08

计算信息检索评价指标pr的源程序_第1页
计算信息检索评价指标pr的源程序_第2页
计算信息检索评价指标pr的源程序_第3页
计算信息检索评价指标pr的源程序_第4页
计算信息检索评价指标pr的源程序_第5页
资源描述:

《计算信息检索评价指标pr的源程序》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库

1、packagefileAndStringOperate;importjava.io.BufferedReader;importjava.io.File;importjava.io.FileOutputStream;importjava.io.FileReader;importjava.io.FileWriter;importjava.io.IOException;importjava.io.OutputStream;publicclassReadFileToString{publicstaticvoidmain(Stri

2、ng[]args)throwsIOException{StringfileData=readtxt("D:\IR\1\JAVA网络爬虫.txt");CountRelatedDocument(fileData);//MyWebRec[]myWebRec=newMyWebRec[2000];ClassifyURL(fileData);}privatestaticStringreadtxt(StringfilePath)throwsIOException{BufferedReaderbr=newBufferedReade

3、r(newFileReader(filePath));Stringstr="";Stringr=br.readLine();while(r!=null){str+=r+"";r=br.readLine();}returnstr;}privatestaticchar[][]readtxtToChar(StringfilePath)throwsIOException{char[][]data=null;intcurrentline=0;BufferedReaderbr=newBufferedReader(newFileR

4、eader(filePath));Stringstr="";Stringr=br.readLine();while(r!=null){str+=r+"";data[currentline++]=str.toCharArray();r=br.readLine();}returndata;}privatestaticintCountRelatedDocument(StringfileData){intcntRelated=0;intcurrentLine=1;intbaiduCnt=0;intbingCnt=0;ints

5、ogouCnt=0;int_360Cnt=0;intState=0;booleanbaiduY[]=newboolean[51];booleanbingY[]=newboolean[51];booleansogouY[]=newboolean[51];boolean_360Y[]=newboolean[51];char[]fileChar=fileData.toCharArray();for(inti=0;i

6、='*'){State++;System.out.println("分点:"+currentLine);}if(fileChar[i]=='')currentLine++;if(currentLine%3==0){if(fileChar[i]=='Y'

7、

8、fileChar[i]=='y'){if(State==1){baiduCnt++;baiduY[currentLine/3]=true;}elseif(State==2){bingCnt++;bingY[currentLine/3-50]=true;//Syste

9、m.out.println(currentLine/3-50);}elseif(State==3){sogouCnt++;sogouY[currentLine/3-100]=true;}elseif(State==4){_360Cnt++;_360Y[currentLine/3-150]=true;}cntRelated++;}}}try{CaculatePR(baiduY,bingY,_360Y,sogouY,cntRelated);}catch(Exceptione){e.getMessage();}System.o

10、ut.println("cntRelated="+cntRelated);System.out.println("baiduCnt="+baiduCnt);System.out.println("bingCnt="+bingCnt);System.out.println("sohuCnt="+sogouCnt);Sy

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。