斯坦福依赖关系手册 ( http://nlp.stanford.edu/software/dependencies_manual.pdf ) 提到:“或者我们的转换工具可以将其他选区解析器的输出转换为斯坦福依赖关系表示。”
有谁知道该工具在哪里可用或如何使用它?
斯坦福解析器文档 ( http://nlp.stanford.edu/software/stanford-dependencies.shtml ) 提到:“可以使用我们的软件 [...] 使用解析器包中提供的 EnglishGrammaticalStructure 类在短语结构树上获得依赖关系。”
我有兴趣获取(ccprocessed)类型依赖列表以在 NLTK 中使用。我看到有一个构造函数 EnglishGrammaticalStructure(Tree t),我想要一些有关如何为其提供 NLTK 树的指导。
第一个想法:使用 nltk.tree.Tree.pprint 生成一个字符串,然后使用 Java 中的 Tree.valueOf 解析它。有什么建议吗?
相关问题:
最佳答案
我不确定您是否看过斯坦福解析器的常见问题解答:
Can I just get your typed dependencies (grammatical relations) output from the trees produced by another parser?
You can use the main method of EnglishGrammaticalStructure. You can give it options like -treeFile to read in trees, and, say, -collapsed to output typedDependenciesCollapsed. For example, this command (with appropriate paths) will convert a Penn Treebank file to uncollapsed typed dependencies:
java -cp stanford-parser.jar edu.stanford.nlp.trees.EnglishGrammaticalStructure -treeFile wsj/02/wsj_0201.mrg -basic
[...]
这里的 mrg
文件是一个“合并”(即 POS 标签和短语结构)Penn Treebank 表示形式,如果您使用适当的语法,您可以让 NLTK 的 Tree.pprint 发出该表示形式定义。但是,我无法对此进行扩展,因为问题描述没有说明为什么这两个工具必须管道化。
关于java - 斯坦福依赖关系转换工具,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17846355/