Views
No views yet
from transformers import AutoTokenizer, AutoModelForTokenClassification
from transformers import pipeline
tokenizer = AutoTokenizer.from_pretrained("Monor/TCMNER")
model = AutoModelForTokenClassification.from_pretrained("Monor/TCMNER")
nlp = pipeline("ner", model=model, tokenizer=tokenizer)
example = "化滞汤,出处:《证治汇补》卷八。。组成:青皮20g,陈皮20g,厚朴20g,枳实20g,黄芩20g,黄连20g,当归20g,芍药20g,木香5g,槟榔8g,滑石3g,甘草4g。。主治:下痢因于食积气滞者。"
ner_results = nlp(example)
print(ner_results)| Abbreviation | Description |
|---|---|
| O | Outside of a named entity |
| B-方剂 | Beginning of a prescription entity right after another prescription entity |
| I-方剂 | Prescription entity |
| B-本草 | Beginning of a herb entity right after another herb entity |
| I-本草 | Herb entity |
| B-来源 | Beginning of a source of prescription right after another source of prescription |
| I-来源 | Source entity |
| B-病名 | Beginning of a disease's name right after another disease's name |
| I-病名 | Disease's name |
| B-症状 | Beginning of a symptom right after another symptom |
| I-症状 | Symptom |
| B-证型 | Beginning of a syndrome right after another syndrome |
| I-证型 | Syndrome |
