use of com.hankcs.hanlp.model.crf.CRFModel in project HanLP by hankcs.
the class TestCRF method testLoadModelWithBiGramFeature.
public void testLoadModelWithBiGramFeature() throws Exception {
String path = HanLP.Config.CRFSegmentModelPath + Predefine.BIN_EXT;
CRFModel model = new CRFModel(new BinTrie<FeatureFunction>());
model.load(ByteArray.createByteArray(path));
Table table = new Table();
String text = "人民生活进一步改善了";
table.v = new String[text.length()][2];
for (int i = 0; i < text.length(); i++) {
table.v[i][0] = String.valueOf(text.charAt(i));
}
model.tag(table);
System.out.println(table);
}
use of com.hankcs.hanlp.model.crf.CRFModel in project HanLP by hankcs.
the class TestCRF method testLoadFromTxt.
public void testLoadFromTxt() throws Exception {
CRFModel model = CRFModel.loadTxt("D:\\Tools\\CRF++-0.58\\example\\seg_cn\\model.txt");
Table table = new Table();
table.v = new String[][] { { "商", "?" }, { "品", "?" }, { "和", "?" }, { "服", "?" }, { "务", "?" } };
model.tag(table);
System.out.println(table);
}
use of com.hankcs.hanlp.model.crf.CRFModel in project HanLP by hankcs.
the class TestCRF method testLoadModelWhichHasNoB.
public void testLoadModelWhichHasNoB() throws Exception {
CRFModel model = CRFModel.loadTxt("D:\\Tools\\CRF++-0.58\\example\\dependency\\model.txt");
System.out.println(model);
}
Aggregations