第一范文网 - 专业文章范例文档资料分享平台

java课程设计报告范例

来源:用户分享 时间:2025/8/9 1:22:35 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

Set keySet=myStorage.getStorage().keySet();

Iterator it=keySet.iterator();

String classpath=null; if(starinPath==null){ classpath=MODELPATH; }else{ classpath =starinPath;

}

File file_txt=new File(classpath+\ FileWriter fw=null;

try { fw=new FileWriter(file_txt); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } while(it.hasNext()){

String modelclass=(String) it.next(); File file=new File(classpath); if(!file.isDirectory()){ System.out.println(file.mkdirs()); }

if(!file_txt.isFile()){ try {

if(file_txt.createNewFile()){ BufferedWriter wb=new BufferedWriter(fw); wb.newLine();

wb.write(modelclass+\ wb.close();

}

} catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace();

}

}

else{

18

// try { fw = new FileWriter(file_txt);

BufferedWriter wb=new BufferedWriter(fw);

wb.append(modelclass+\ector(modelclass).toString()); wb.newLine(); wb.flush();

} catch (IOException e) {

// TODO Auto-generated catch block e.printStackTrace();

}

}

} }

public TermVectorStorage getModel(String modelpath){ TermVector tv=null;

if(modelpath==null){ modelpath=MODELPATH+\

}

File file=new File(modelpath);

FileReader fread; try { fread = new FileReader(file); BufferedReader br=new BufferedReader(fread,512); String line=null; String keyword=null; String value=null; do{ line=br.readLine(); if(line==null)

break;

int start=line.indexOf(\// System.out.println(\ if(start>0) {

keyword=line.substring(0,start);

19

line=line.substring(start+1);

// }

List list_String=new ArrayList(); List list_Integer=new ArrayList(); while(line.indexOf(\ String key=line.substring(line.indexOf(\ key=key.trim();

line=line.substring(line.indexOf(\ String value1=line.substring(0,line.indexOf(\ value1=value1.trim();

Integer value_int=new Integer(value1); list_String.add(key);

list_Integer.add(value_int);

}

String[] array_str=new String[list_String.size()]; for(int i=0;i

}

int[] array_int=new int[list_Integer.size()]; for(int i=0;i

array_int[i]=list_Integer.get(i); }

tv=new TermVector((String[]) array_str,array_int);

storage.addTermVector(keyword, tv);

}

}while(line!=null);

} catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace();

}

System.out.println(storage.getTermVector(\电气机械及器材制造业\

return storage;

20

public TermVectorStorage getModel(){ return getModel(null); }

// private void writeFile(String path,String modelname,String key,Map StoreMap){ //

// File file=new File(path);

// if(!file.isFile()){ // System.out.println(file.mkdirs()); // }

// File file_txt=new File(path+\// if(!file_txt.isFile()){ // try { // // if(file_txt.createNewFile()){ // FileWriter fw=new FileWriter(file_txt); // BufferedWriter wb=new BufferedWriter(fw); // //

// }

// } catch (IOException e) { // // TODO Auto-generated catch block // e.printStackTrace();

// }

//

//

}

// } /**

* @see net.sf.classifier4J.ICategorisedClassifier#isMatch(java.lang.String, java.lang.String) */

public boolean isMatch(String category, String input) throws ClassifierException { return (getMatchCutoff() < classify(category, input)); } /**

* @see net.sf.classifier4J.ITrainable#teachMatch(java.lang.String, java.lang.String) */

public void teachMatch(String category, String input) throws ClassifierException { // Create a map of the word frequency from the input

Map wordFrequencies = Utilities.getWordFrequency(input, false, tokenizer, stopWordsProvider);

// get the numTermsInVector most used words in the input

Set mostFrequentWords = Utilities.getMostFrequentWords(numTermsInVector, wordFrequencies);

21

搜索更多关于: java课程设计报告范例 的文档
java课程设计报告范例.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c4z8al2r91x47le14llcz_6.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top