斯坦福python中文分词stanza
生活随笔
收集整理的這篇文章主要介紹了
斯坦福python中文分词stanza
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 斯坦福python中文分詞stanza
?
1 下載?Stanford CoreNLP相關文件 下載完整的組件?https://stanfordnlp.github.io/CoreNLP/index.html 下載中文模型文件? 解壓stanford-corenlp-full-2018-02-27.zip,并將下載的模型文件stanford-chinese-corenlp-2018-10-05-models.jar、 StanfordCoreNLP-chinese.properties 拷貝到上述解壓的文件夾內 2 配置并檢驗JAVA環境 java -version 3 下載并安裝 stanza? 手動下載或者通過git方式下載 stanza源文件?https://codeload.github.com/stanfordnlp/stanza/zip/master 在解壓的文件內執行 python3 setup.py install 4 啟動服務 java -Xmx6g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -serverProperties StanfordCoreNLP-chinese.properties -port 9000 -timeout 15000 5 通過python調用分詞驗證 from stanza.nlp.corenlp import CoreNLPClient client = CoreNLPClient(server='http://localhost:9000', default_annotators=['ssplit', 'lemma', 'tokenize ', 'pos', 'ner']) # 注意在以前的版本中,中文分詞為 segment,新版已經和其他語言統一為 tokenize # 分詞和詞性標注測試 test1 = "財政部會計司發布通知稱,上海財經大學會計學院原副教授錢逢勝同志不再符合擔任企業會計準則咨詢委員 會委員條件,現決定辭聘錢逢勝擔任的企業會計準則咨詢委員會委員。" annotated = client.annotate(test1) for sentence in annotated.sentences: for token in sentence: print(token)?
總結
以上是生活随笔為你收集整理的斯坦福python中文分词stanza的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 360信用分怎么查询
- 下一篇: 美特斯邦威拟卖资产回血 一年巨亏8.25