public class PerceptronSegmenter extends PerceptronTagger implements Segmenter
model| Constructor and Description |
|---|
PerceptronSegmenter()
加载配置文件指定的模型
|
PerceptronSegmenter(LinearModel cwsModel) |
PerceptronSegmenter(String cwsModelFile) |
| Modifier and Type | Method and Description |
|---|---|
protected Instance |
createInstance(Sentence sentence,
FeatureMap featureMap) |
double[] |
evaluate(String corpora)
性能测试
|
boolean |
learn(String... words)
在线学习
|
boolean |
learn(String segmentedSentence)
在线学习
|
List<String> |
segment(String sentence)
中文分词
|
void |
segment(String text,
Instance instance,
List<String> output) |
void |
segment(String text,
List<String> output) |
void |
segment(String text,
String normalized,
List<String> output) |
getModel, learn, learnevaluate, evaluate, normalizepublic PerceptronSegmenter(LinearModel cwsModel)
public PerceptronSegmenter(String cwsModelFile) throws IOException
IOExceptionpublic PerceptronSegmenter()
throws IOException
IOExceptionpublic List<String> segment(String sentence)
Segmenterpublic boolean learn(String segmentedSentence)
segmentedSentence - 分好词的句子,空格或tab分割,不含词性public boolean learn(String... words)
words - 分好词的句子protected Instance createInstance(Sentence sentence, FeatureMap featureMap)
createInstance in class InstanceConsumerpublic double[] evaluate(String corpora) throws IOException
PerceptronTaggerevaluate in class PerceptronTaggercorpora - 数据集IOExceptionCopyright © 2014–2021 码农场. All rights reserved.