Взял код со страницы
Quickstart из документации GLiNKER
from glinker import ProcessorFactory
# Create a simple entity linking pipeline
executor = ProcessorFactory.create_simple(
model_name="knowledgator/gliner-bi-base-v2.0",
threshold=0.5,
entities=[
{"entity_id": "Q101", "label": "insulin", "description": "Peptide hormone regulating blood glucose"},
{"entity_id": "Q102", "label": "glucose", "description": "Primary blood sugar and key metabolic fuel"},
{"entity_id": "Q103", "label": "GLUT4", "description": "Insulin-responsive glucose transporter in muscle and adipose tissue"},
{"entity_id": "Q104", "label": "pancreatic beta cell", "description": "Endocrine cell type that secretes insulin"},
],
)
result = executor.execute({
"texts": [
"After a meal, pancreatic beta cells release insulin, which promotes GLUT4 translocation and increases glucose uptake in muscle."
]
})
l0_result = result.get("l0_result")
for entity in l0_result.entities:
if entity.linked_entity:
print(f"{entity.mention_text} → {entity.linked_entity.label}")
print(f" Confidence: {entity.linked_entity.score:.3f}")
Я ничего в нём не меняю, но при запуске приложения получаю следующее исключение:
Exception has occurred: AttributeError
'list' object has no attribute 'linked_entity'
File "C:\work\test\linker.py", line 23, in <module>
if entity.linked_entity:
^^^^^^^^^^^^^^^^^^^^
AttributeError: 'list' object has no attribute 'linked_entity'