policies¶
knowledge_graph.news.policies
Combine spaCy and ReLiK mention spans and assign their entity links.
overlaps(left, right)
¶
Source code in src/knowledge_graph/news/policies.py
6 7 | |
select_without_overlap(ranked, selected=())
¶
Spans taken in order, skipping any that overlaps a span already selected.
Source code in src/knowledge_graph/news/policies.py
10 11 12 13 14 15 16 | |
longest_first(spans)
¶
Source code in src/knowledge_graph/news/policies.py
19 20 | |
first_flat(preferred, other)
¶
Preferred spans longest-first without overlaps, then the other system's spans in document order.
Source code in src/knowledge_graph/news/policies.py
23 24 25 | |
length_flat(spacy, relik, longest)
¶
The union longest- or shortest-first, ReLiK first on equal length, without overlaps.
Source code in src/knowledge_graph/news/policies.py
28 29 30 31 32 33 34 35 | |
drop_boundary_conflicts(spacy, relik)
¶
Exact agreements and spans that overlap no span of the other system, longest-first without overlaps.
Source code in src/knowledge_graph/news/policies.py
38 39 40 41 42 43 | |
default_links(policy)
¶
A single system keeps its own links; combined policies prefer ReLiK, except spaCy-first flat.
Source code in src/knowledge_graph/news/policies.py
67 68 69 70 71 | |