中文分词检索系统

himlly2884 46 0 RAR 2018-12-25 11:12:13

public static void main (String[] args) throws ParserException { try { TravelWordTable(RadarSpecialSearchEngine.fdz+"/字典.txt"); } catch(Exception e) { e.printStackTrace(); } } public static void TravelWordTable(String filename) throws IOException { try{ String buffer ; FileWriter resultFile = null; PrintWriter myFile = null; String dstfile = filename+ "_dsturl.txt" ; File writefile = new File(dstfile 1;; if(!writefile.exists()) { writefile.createNewFile(); } resultFile=new FileWriter(writefile); myFile = new PrintWriter(resultFile); BufferedReader reader = new BufferedReader(new FileReader(filename)); while((buffer = reader.readLine())!=null) { String b = buffer; System.out.println("开始检索关键字:"+b); buffer = URLEncoder.encode(buffer, "UTF-8"); String url = "http://s.wanfangdata.com.cn/Paper.aspx?q=" + buffer + "&f=top"; getWanFangUrls(url,"UTF-8",myFile); System.out.println("关键字:"+b+" 检索完成"); } if( myFile != null) myFile.close(); if( resultFile != null) resultFile.close(); } catch (ParserException e) { e.printStackTrace(); }

用户评论
请输入评论内容
评分:
暂无评论