use of org.nlpcn.commons.lang.tire.domain.Value in project ansj_seg by NLPchina.
the class DicLibrary method insert.
/**
* 关键词增加
*
* @param keyword 所要增加的关键词
* @param nature 关键词的词性
* @param freq 关键词的词频
*/
public static void insert(String key, String keyword, String nature, int freq) {
Forest dic = get(key);
String[] paramers = new String[2];
paramers[0] = nature;
paramers[1] = String.valueOf(freq);
Value value = new Value(keyword, paramers);
Library.insertWord(dic, value);
}
use of org.nlpcn.commons.lang.tire.domain.Value in project ansj_seg by NLPchina.
the class ReloadAmbiguityLibrary method loadFormStr.
private static void loadFormStr() {
Forest forest = AmbiguityLibrary.get();
//方法1
Value value = new Value("三个和尚", "三个", "m", "和尚", "n");
Library.insertWord(forest, value);
//方法2
AmbiguityLibrary.insert(AmbiguityLibrary.DEFAULT, "三个", "m", "和尚", "n");
// 将新构建的辞典树替换掉旧的。
AmbiguityLibrary.put(AmbiguityLibrary.DEFAULT, AmbiguityLibrary.DEFAULT, forest);
}
Aggregations