首页 > 解决方案 > 如何使用StanfordCoreNLP实现中文Penn Treebank(s-expression)到CONLL格式的转换?

问题描述

我有 Penn Treebank (s-expression) 格式的中国选区树库,我想获取 conll 格式的数据。我知道 StanfordCoreNLP 可以使用这个命令转换英文数据

java -mx1g edu.stanford.nlp.trees.ud.UniversalDependenciesConverter -treeFile treebank > treebank.conllu

而且我也知道 StanfordCoreNLP 支持使用命令选择中文语言模型

java -mx3g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLP -props StanfordCoreNLP-chinese.properties -file chinese.txt -outputFormat text

当我使用命令时

java -mx3g -cp "*" edu.stanford.nlp.trees.ud.UniversalDependenciesConverter -props StanfordCoreNLP-chinese.properties -treeFile chtb_0001.nw > chtb_0001_nw.conllu

没有任何变化,在这种情况下,StanfordCoreNLP 工具仍然选择英文模型而不是中文模型。我无法从 StanfordCoreNLP 的主页获得更多详细信息。所以我想从 StackoverFlow 获得帮助。

标签: stanford-nlp

解决方案


我认为这会起作用:

java -Xmx1g edu.stanford.nlp.trees.international.pennchinese.UniversalChineseGrammaticalStructure -treeFile ctb_example.txt -checkConnected -basic -keepPunct -conllx

推荐阅读