textcategorization.java~7~
来自「基于朴素贝叶斯算法实现的中文文本分类程序。可以对中文文本进行分类识别」· JAVA~7~ 代码 · 共 44 行
JAVA~7~
44 行
/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2005</p> * <p>Company: </p> * @author not attributable * @version 1.0 */import java.io.*;public class TextCategorization { public static void main(String[] args) throws Exception { // Load the dictionary Dictionary dic = new Dictionary("SDIC.txt"); // Construct a segmentor. //FMMSegment seg = new FMMSegment(dic); //String str = "分词系统演示"; //System.out.println(str); //seg.wordSegment(str); //System.out.println("----------------------------------"); //System.out.println("Segmention from a file ...."); //seg.fileSegment("sample/science.txt"); //System.out.println("----------------------------------"); System.out.println("--------------Start training-----------------"); Traning train=new Traning(dic); train.loadVocabulary(); System.out.println("--------------End of training-----------------"); try{ BufferedWriter out=new BufferedWriter(new FileWriter("vocabulary.txt")); out.write(new String(""),0,0); out.flush(); }catch(Exception e){ } }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?