我想使用stanford corenlp来获取句子的依赖解析器。为了在python中使用stanford corenlp,我们需要在Google Colab中执行以下步骤:
import os
!apt-get install openjdk-8-jdk-headless -qq> / dev / null
os.environ [“ JAVA_HOME”] =“ / usr / lib / jvm / java-8-openjdk-amd64”
!wget http://nlp.stanford.edu/software/stanford-corenlp-full-2018-10-05.zip
!unzip stanford-corenlp-full-2018-10-05.zip
“ java -mx4g -cp” *“ edu.stanford.nlp.pipeline.StanfordCoreNLPServer端口9001-超时75000“
之后,stanford-corenlp服务器将在'http://localhost:9001'下运行
[当我尝试关注帖子@时how to run stanford corenlp server on google colab?我最终得到响应:
端口9001已关闭,正在重试...
端口9001已关闭,正在重试...
端口9001已关闭,正在重试...
端口9001已关闭,正在重试...
还有没有其他两个我可以在两个不同的Google colab .ipynb之间建立连接的技术或教程?
LOGDIR = '/tmp/log'
get_ipython().system_raw(
'java -mx8g -cp "*"
edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9001 ->timeout 60000 &'
.format(LOGDIR)
)
! wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
! unzip ngrok-stable-linux-amd64.zip
get_ipython().system_raw('./ngrok http 9001 &')
! curl -s http://localhost:4040/api/tunnels | python3 -c \
"import sys, json; print(json.load(sys.stdin)['tunnels'][0]['public_url'])"
URL_DEFAULT =“ http://localhost:9000”