17 lines
614 B
Python
17 lines
614 B
Python
import spacy, os
|
|
#pip install spacy
|
|
#python -m spacy download xx_ent_wiki_sm
|
|
|
|
model = "./taggers/final-model.pt"
|
|
# model = os.getcwd() + "/data/HooshvareLab--bert-base-parsbert-ner-uncased"
|
|
print(model)
|
|
#model = "HooshvareLab/bert-base-parsbert-ner-uncased"
|
|
nlp = spacy.load(model) # مدل مورد نیاز را بارگیری کنید
|
|
|
|
text = "فولاد مبارکه در اصفهان به عنوان شرکت بزرگی معرفی شده است"
|
|
#text = "Apple is looking at buying U.K. startup for $1 billion"
|
|
#"Enter your text in here"
|
|
doc = nlp(text)
|
|
|
|
for ent in doc.ents:
|
|
print(ent.text, ent.label_) |