stanford python中文分词
生活随笔
收集整理的這篇文章主要介紹了
stanford python中文分词
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
總結,只有三步:
一
下載coreNLP
https://stanfordnlp.github.io/CoreNLP/download.html
二
下載
http://nlp.stanford.edu/software/stanford-chinese-corenlp-2016-10-31-models.jar
?然后把這個jar文件復制到第一步解壓后的文件夾中
三
python輸入以下代碼,路徑改成上面的stanford-chinese-corenlp-2016-10-31-models.jar所在文件夾路徑
from stanfordcorenlp import StanfordCoreNLPnlp = StanfordCoreNLP(r'/home/appleyuchi/PycharmProjects/csdn_blog/72993873StanfordCoreNLP進行中文分詞/stanford-corenlp-full-2017-06-09', lang='zh')sentence = '清華大學位于北京。' print (nlp.word_tokenize(sentence)) print (nlp.pos_tag(sentence)) print (nlp.ner(sentence)) print (nlp.parse(sentence)) print (nlp.dependency_parse(sentence))總結
以上是生活随笔為你收集整理的stanford python中文分词的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python实现最小二乘法(转)
- 下一篇: python中urllib.quote出