Skip to content
Snippets Groups Projects
Commit 2c66220a authored by ih322@uni-heidelberg.de's avatar ih322@uni-heidelberg.de
Browse files

Fix T5 NEC

parent b08b587c
No related branches found
No related tags found
No related merge requests found
from src.models.T5 import T5
from src.models.T5 import infer_nli
def classify_entity(sentence, entity, labels):
model = T5.instance()
print("classify entity")
for label in labels:
print(f"Label: {label}")
hypothesis = f"{entity} is a {label}"
result = model.infer_nli(sentence, hypothesis)
result = infer_nli(sentence, hypothesis)
print(f"Hypothesis: {hypothesis}, Result: {result}")
# TODO: determine highest confidence prediction
return labels[0]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment