Skip to content

Commit 5794097

Browse files
committed
感知机句法分析器文档
1 parent 5612f7f commit 5794097

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/main/java/com/hankcs/hanlp/dependency/perceptron/parser/KBeamArcEagerDependencyParser.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,18 @@ public KBeamArcEagerDependencyParser(String modelPath) throws IOException, Class
5757
).enableCustomDictionary(false), new KBeamArcEagerParser(modelPath));
5858
}
5959

60+
/**
61+
* 训练依存句法分析器
62+
*
63+
* @param trainCorpus 训练集
64+
* @param devCorpus 开发集
65+
* @param clusterPath Brown词聚类文件
66+
* @param modelPath 模型储存路径
67+
* @throws InterruptedException
68+
* @throws ExecutionException
69+
* @throws IOException
70+
* @throws ClassNotFoundException
71+
*/
6072
public void train(String trainCorpus, String devCorpus, String clusterPath, String modelPath) throws InterruptedException, ExecutionException, IOException, ClassNotFoundException
6173
{
6274
Options options = new Options();
@@ -75,6 +87,14 @@ public CoNLLSentence parse(List<Term> termList)
7587
return parse(termList, 64, 1);
7688
}
7789

90+
/**
91+
* 执行句法分析
92+
*
93+
* @param termList 分词结果
94+
* @param beamWidth 柱搜索宽度
95+
* @param numOfThreads 多线程数
96+
* @return 句法树
97+
*/
7898
public CoNLLSentence parse(List<Term> termList, int beamWidth, int numOfThreads)
7999
{
80100
String[] words = new String[termList.size()];

0 commit comments

Comments
 (0)