File size: 709 Bytes
b04211c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
---
language:
- zh
license: apache-2.0
tags:
- Roberta
- CWS
- Chinese Word Segmentation
- Chinese
inference: false
---
#### How to use
You can use this model with Transformers *pipeline* for token-classification.
```python
from transformers import AutoTokenizer, AutoModelForTokenClassification
from transformers import pipeline
nlp = pipeline("token-classification", model="enpchina/cws_chinese_shunpao_0923", aggregation_strategy="simple")
example = "非兩君之盡心於民事,以實心而行實政, 其能得此,於諸紳士也哉。"
cws_results = nlp(example)
print(cws_results)
print()
tab = [w["word"].replace(" ","") for w in cws_results]
print(tab)
print()
print(" ".join(tab))
```
|