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

📄 textcategorization.java~12~

📁 基于朴素贝叶斯算法实现的中文文本分类程序。可以对中文文本进行分类识别
💻 JAVA~12~
字号:
/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2005</p> * <p>Company: </p> * @author not attributable * @version 1.0 */import java.io.*;import javax.swing.*;import java.awt.event.*;import java.awt.*;import javax.swing.border.*;public class TextCategorization extends JComponent {  JButton jButton1 = new JButton();  TitledBorder titledBorder1;  public TextCategorization(){    try {      jbInit();    }    catch(Exception e) {      e.printStackTrace();    }    setVisible(true);    show();  }  public static void main(String[] args) throws Exception{    TextCategorization frame=new TextCategorization();                // 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){                  }*/          }  private void jbInit() throws Exception {    titledBorder1 = new TitledBorder("");    jButton1.setText("jButton1");    jButton1.addActionListener(new TextCategorization_jButton1_actionAdapter(this));    this.setLayout(null);    this.setBorder(titledBorder1);    this.add(jButton1, null);  }  void jButton1_actionPerformed(ActionEvent e) {  }}class TextCategorization_jButton1_actionAdapter implements java.awt.event.ActionListener {  TextCategorization adaptee;  TextCategorization_jButton1_actionAdapter(TextCategorization adaptee) {    this.adaptee = adaptee;  }  public void actionPerformed(ActionEvent e) {    adaptee.jButton1_actionPerformed(e);  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -