java - 斯坦福依赖关系转换工具

标签 java python nltk stanford-nlp

斯坦福依赖关系手册 ( 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/

相关文章:

python - 定位没有绝对路径的python脚本

python - 在python中计算大数据集相似度矩阵的有效方法

python - 如何从python中的字符串中搜索换行符

java - 将来自 Pubsub 的每 X 条消息写入 Cloud Storage

java - 如何创建动态调用其他 Java 类的 HashMap?

java - 如何每隔n个字符截取一个字符串?但只有当有空格时才会剪切

python - 在python中提高组合wav文件的播放速度?

python - 在 Python 中使用多处理,导入语句的正确方法是什么?

java - 如何抑制控制台中的Flyway迁移输出?

python - AttributeError : 'list' object has no attribute 'isdigit' . 有效指定句子列表中每个单词的 POS?