?? traning.java
字號:
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2005</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
import java.util.*;
public class Traning {
FMMSegment vocabulary;
Sample []v=new Sample[3];
Dictionary dict;
public Traning(Dictionary newDict) {
vocabulary=new FMMSegment(newDict);
dict=newDict;
}
public void train(){
for(int i=0;i<3;i++){
v[i]=new Sample();
v[i].init(dict,vocabulary.vocabulary,vocabulary.NumOfVoc());
}
//掃描文本樣例,計算P(wk|vj)
v[0].countFreq("sample/science.txt");
v[0].getP();
v[1].countFreq("sample/sport.txt");
v[1].getP();
v[2].countFreq("sample/history.txt");
v[2].getP();
}
public void loadVocabulary(){
vocabulary.fileSegment("Sample/sport.txt");
vocabulary.fileSegment("Sample/science.txt");
vocabulary.fileSegment("Sample/history.txt");
System.out.println("totle number of vocabulary is:"+vocabulary.NumOfVoc());
//System.out.println(vocabulary.vocabulary.containsKey("顆粒"));
train();
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -