⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 textcategorization.java~10~

📁 基于朴素贝叶斯算法实现的中文文本分类程序。可以对中文文本进行分类识别
💻 JAVA~10~
字号:
/** * <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-----------------");                  System.out.println("-------------start categorize text------------");                  TargetText tt=new TargetText();                  tt.init(dic);                  tt.categorize(train.v,3,"testSample.txt");                  //自动清空vocabulary文件                  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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -