stanford parser生成依存树使用记录

下载了parser包,https://nlp.stanford.edu/software/lex-parser.shtml#Download

我下载的是stanford-parser-full-2016-10-31

解压之后运行下面的命令,即可生成依存树

java -mx1g -cp stanford-parser.jar edu.stanford.nlp.parser.lexparser.LexicalizedParser -maxLength 100 -retainTmpSubcategories -outputFormat "typedDependencies" -sentences newline  ./edu/stanford/nlp/models/lexparser/englishFactored.ser.gz  test.txt > output.txt


-cp stanford-parser.jar是为了使用jar中的LexicalizedParser类

-outputFormat "typedDependencies" 输出如下格式

-sentences newline 是为了按行处理文件

englishFactored.ser.gz刚开始运行该命令一直找不到这个文件,就把stanford-parser-3.7.0-models.jar解压之后 写上该文件的路径即可

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容