stanford NLP(源码:https://github.com/stanfordnlp/CoreNLP)是业界非常著名的自然语言处理(NLP)套件之一,提供了面向多种语言的多种自然语言处理任务,具体如下:
Stanford Named Entity Recognizer
Stanford Coreference Resolution
Stanford Temporal Tagger (SUTime)
Stanford Pattern-based Information Extraction and Diagnostics (SPIED)
实现python来调用stanford NLP,是PYTHON程序员进行数据处理经常需要用到的工具,coreNLP本身也提供了官方进行python调用的程序包(https://github.com/stanfordnlp/python-stanford-corenlp),而本文主要是基于stanforfd提供的另外一个开源程序stanza(https://github.com/stanfordnlp/stanza)来实现python调用。
其介绍如下:
Stanza is the Stanford NLP group’s shared repository for Python infrastructure. The goal of Stanza is not to replace your modeling tools of choice, but to offer implementations for common patterns useful for machine learning experiments.
A:启动coreNLP服务,在下载包中,进行服务的启动
# Run the server using all jars in the current directory (e.g., the CoreNLP home directory)
java -mx4g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9000 -timeout 15000
主要启动界面如下:
B:在浏览器中输入网址:http://localhost:9000,可以进行测试和查看NLP处理结果。
(3)基于stanza来实现corenlp调用。
这里采用python3来进行源码的重构,去掉一些原始python2.*风格的错误。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。