模型:
julien-c/flair-ner
从 https://nlp.informatik.hu-berlin.de/resources/models/ner/ 导入
from flair.data import Sentence from flair.models import SequenceTagger sentence = Sentence( "My name is Julien, I currently live in Paris, I work at Hugging Face, Inc." ) tagger = SequenceTagger.load("julien-c/flair-ner") # predict NER tags tagger.predict(sentence) # print sentence with predicted tags print(sentence.to_tagged_string())
产生以下输出:
我的名字是Julien,我目前住在巴黎,我在Hugging Face工作。