add README
Browse files
README.md
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
## Intended uses & limitations
|
3 |
+
|
4 |
+
#### How to use
|
5 |
+
|
6 |
+
You can use this model with Transformers *pipeline* for NER.
|
7 |
+
|
8 |
+
```python
|
9 |
+
from transformers import AutoTokenizer, AutoModelForTokenClassification
|
10 |
+
from transformers import pipeline
|
11 |
+
|
12 |
+
nlp = pipeline("token-classification", model="enpchina/cws_chinese_roberta_shunpao", aggregation_strategy="simple")
|
13 |
+
example = "非兩君之盡心於民事,以實心而行實政, 其能得此,於諸紳士也哉。"
|
14 |
+
cws_results = nlp(example)
|
15 |
+
print(cws_results)
|
16 |
+
print()
|
17 |
+
tab = [w["word"].replace(" ","") for w in cws_results]
|
18 |
+
print(tab)
|
19 |
+
print()
|
20 |
+
print(" ".join(tab))
|
21 |
+
```
|