相关疑难解决方法(0)

使用 Huggingface Transformer 进行命名实体识别,映射回完整实体

我正在查看用于命名实体识别的 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)

huggingface-transformers

7
推荐指数
1
解决办法
2522
查看次数

标签 统计

huggingface-transformers ×1