use of com.hankcs.hanlp.model.crf.FeatureTemplate in project HanLP by hankcs.
the class TestCRF method testTestLoadTemplate.
public void testTestLoadTemplate() throws Exception {
DataOutputStream out = new DataOutputStream(new FileOutputStream("data/test/out.bin"));
FeatureTemplate featureTemplate = FeatureTemplate.create("U05:%x[-2,0]/%x[-1,0]/%x[0,0]");
featureTemplate.save(out);
featureTemplate = new FeatureTemplate();
featureTemplate.load(ByteArray.createByteArray("data/test/out.bin"));
System.out.println(featureTemplate);
}
use of com.hankcs.hanlp.model.crf.FeatureTemplate in project HanLP by hankcs.
the class TestCRF method testTemplate.
public void testTemplate() throws Exception {
FeatureTemplate featureTemplate = FeatureTemplate.create("U05:%x[-2,0]/%x[-1,0]/%x[0,0]");
Table table = new Table();
table.v = new String[][] { { "那", "S" }, { "音", "B" }, { "韵", "E" } };
char[] parameter = featureTemplate.generateParameter(table, 0);
System.out.println(parameter);
}
Aggregations