我正在查看用于命名实体识别的 Huggingface 管道的文档,我不清楚这些结果如何用于实际的实体识别模型。
例如,给出文档中的示例:
>>> from transformers import pipeline
>>> nlp = pipeline("ner")
>>> sequence = "Hugging Face Inc. is a company based in New York City. Its headquarters are in DUMBO, therefore very"
... "close to the Manhattan Bridge which is visible from the window."
This outputs a list of all words that have been identified as an entity from the 9 classes defined above. Here is the expected results:
print(nlp(sequence))
[
{'word': 'Hu', 'score': 0.9995632767677307, 'entity': …Run Code Online (Sandbox Code Playgroud)