score¶
knowledge_graph.news.score
Score exact news entity spans, span-QID links, and normalized Wikipedia titles.
normalize_title(value: str) -> str
¶
Source code in src/knowledge_graph/news/score.py
14 15 16 | |
title_key(entity)
¶
Cache key of a ReLiK entity: its Wikipedia title with whitespace collapsed.
Source code in src/knowledge_graph/news/score.py
19 20 21 | |
stored_qid(entity)
¶
The QID written into the entity (gold files and spaCy predictions).
Source code in src/knowledge_graph/news/score.py
24 25 26 | |
title_qids(cache)
¶
ReLiK QIDs from resolving the predicted Wikipedia titles through the title-to-QID cache.
Source code in src/knowledge_graph/news/score.py
29 30 31 | |
candidate_qids(cache)
¶
ReLiK QIDs stored with the retrieved candidate when the index provides them, else from the title cache.
Source code in src/knowledge_graph/news/score.py
34 35 36 | |
spans_and_links(payload, qid_of=stored_qid)
¶
Return {doc: spans} and {doc: {span: QIDs}} from entity predictions.
Source code in src/knowledge_graph/news/score.py
39 40 41 42 43 44 45 46 47 48 | |
flatten_spans(spans)
¶
Source code in src/knowledge_graph/news/score.py
51 52 | |
flatten_links(links)
¶
Source code in src/knowledge_graph/news/score.py
55 56 | |
assign_links(selected, spacy_links, relik_links, links)
¶
QIDs of the selected spans under one link assignment.
Source code in src/knowledge_graph/news/score.py
59 60 61 62 63 64 65 66 67 68 | |
score_policies(gold, spacy, relik)
¶
NER of every policy and EL of its default links; the combined mentions get every link assignment.
Source code in src/knowledge_graph/news/score.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
mind_gold(path)
¶
Source code in src/knowledge_graph/news/score.py
93 94 95 | |
dwie_gold(path)
¶
Gold mention spans and span-QID links of the DWIE QID gold.
Source code in src/knowledge_graph/news/score.py
98 99 100 101 102 103 104 105 106 107 108 | |
cached_title_qids(path, relik_paths, provided_qid=stored_qid)
¶
QIDs of the predicted titles without a QID from the selected link source, from the cache or looked up online.
Source code in src/knowledge_graph/news/score.py
111 112 113 114 115 | |
policies(args)
¶
Every span policy on each MIND-50 and DWIE input.
Source code in src/knowledge_graph/news/score.py
118 119 120 121 122 123 124 125 126 127 128 129 130 | |
indexes(args)
¶
ReLiK alone on MIND-50 with each retrieval index.
Source code in src/knowledge_graph/news/score.py
133 134 135 136 137 138 139 140 141 142 143 144 145 | |
titles(args)
¶
Exact span and Wikipedia title EL, excluding spans annotated only with a QID.
Source code in src/knowledge_graph/news/score.py
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
add_qid_arguments(parser)
¶
Source code in src/knowledge_graph/news/score.py
174 175 176 | |
main()
¶
Source code in src/knowledge_graph/news/score.py
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | |