python直接安装stanza:
pip install stanza
也可以使用conda、github等源码安装:
https://stanfordnlp.github.io/stanza/installation_usage.html
英文:
https://stanfordnlp.github.io/stanza/installation_usage.html
中文:
http://nlp.stanford.edu/software/stanza/1.0.0/zh-hans/default.zip
a. mac 是放在~/stanza_resources路径下
├── resources.json
├── zh-hans
│ ├── backward_charlm
│ │ └── gigaword.pt
│ ├── depparse
│ │ └── gsdsimp.pt
│ ├── forward_charlm
│ │ └── gigaword.pt
│ ├── lemma
│ │ └── gsdsimp.pt
│ ├── ner
│ │ └── ontonotes.pt
│ ├── pos
│ │ └── gsdsimp.pt
│ ├── pretrain
│ │ └── gsdsimp.pt
│ ├── resources.json
│ └── tokenize
│ └── gsdsimp.pt
└── zh-hans.zip
b. 如果不知道指定的路径,可以进python交互界面:
import stanza
zh_nlp = stanza.Pipeline('zh')
首先,import python包,由于未安装中文语言模型,会返回error,并告知模型应该存放的路径:
zh-hans -> 给出安装的【target】路径
然后,在python交互界面,重新输入zh_nlp = stanza.Pipeline(‘zh’):
2020-07-09 11:56:06 INFO: "zh" is an alias for "zh-hans"
2020-07-09 11:56:06 INFO: Loading these models for language: zh-hans (Simplified_Chinese):
=========================
| Processor | Package |
-------------------------
| tokenize | gsdsimp |
| pos | gsdsimp |
| lemma | gsdsimp |
| depparse | gsdsimp |
| ner | ontonotes |
=========================
2020-07-09 11:56:06 INFO: Use device: cpu
2020-07-09 11:56:06 INFO: Loading: tokenize
2020-07-09 11:56:06 INFO: Loading: pos
2020-07-09 11:56:09 INFO: Loading: lemma
2020-07-09 11:56:09 INFO: Loading: depparse
2020-07-09 11:56:12 INFO: Loading: ner
2020-07-09 11:56:13 INFO: Done loading processors!
最后,安装成功,撒花