Advertisement

Linux安装Stanford-CoreNLP

阅读量:

一、首先需要安装java8

brew cask install java

安装成功后用命令”java -version”可查看版本信息

二、下载Stanford coreNLP 包

获取https://stanfordnlp.github.io/CoreNLP/上的CoreNLP 3.9.2软件包及其配套的模型jar包集合,并支持英文字版以及中文字版。

或如下地址:

Stanford NLP工具包(http://nlp.stanford.edu/software/stanford-corenlp-full-2018-10-05.zip

中文模型的JAR文件(放置于Stanford CoreNLP 2018年2月27日版本软件包的根目录中):http://nlp.stanford.edu/software/stanford-chinese-corenlp-2018-02-27-models.jar]

2、进入解压缩的目录,并设置类路径

for file in find . -name "*.jar"; do export CLASSPATH="CLASSPATH:`realpath file`"; done

当频繁使用时,在~/.bash_profile等环境变量文件中设置(应将目录设置为相应路径)。

for file in find /path/to/corenlp/ -name "*.jar"; do export CLASSPATH="CLASSPATH:`realpath file`"; done

三、生成文本文件并运行CoreNLP

echo "the quick brown fox jumped over the lazy dog" > input.txt java -mx3g edu.stanford.nlp.pipeline.StanfordCoreNLP -outputFormat json -file input.txt

参考:https://stanfordnlp.github.io/CoreNLP/download.html

全部评论 (0)

还没有任何评论哟~