relations¶
knowledge_graph.news.relations
Predict and score DWIE relations with ATLOP or DREEAM, using reference or predicted entities.
score_key(row: dict) -> tuple
¶
Set key for scoring: unmapped relations never match a gold relation.
Source code in src/knowledge_graph/news/relations.py
20 21 22 23 | |
to_gold(local: set[tuple], mappings: list[dict]) -> list[dict]
¶
Relations between gold concepts, once per document; a predicted-mention relation with an endpoint outside the gold mentions keeps its prediction ids and is marked unmapped.
Source code in src/knowledge_graph/news/relations.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | |
evaluate(predictions: dict[str, list[dict]], documents: list[dict], groups: dict[str, set[str]]) -> dict
¶
Scores of every condition on each document group, and the document-level row when both of its parts exist.
Source code in src/knowledge_graph/news/relations.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |
write_scores(predictions_path, gold_path, out, tokenizer)
¶
Source code in src/knowledge_graph/news/relations.py
60 61 62 | |
score(args: argparse.Namespace) -> None
¶
Source code in src/knowledge_graph/news/relations.py
65 66 | |
predict(args: argparse.Namespace) -> None
¶
Write predictions and scores for the selected input conditions.
Source code in src/knowledge_graph/news/relations.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
main() -> None
¶
Source code in src/knowledge_graph/news/relations.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | |