adsfolio.pdf.annotation_matching
Find annotation locations locally for explicit review.
Text similarity does not establish the same scientific meaning. This module reads PDF text and coordinates without accessing credentials or a network.
- class adsfolio.pdf.annotation_matching.TextIndex(path)[source]
Bases:
adsfolio.pdf.annotation_merge.WordIndexIndex PDF words and normalized character-to-word coordinates.
- Parameters:
path (Path)
- class adsfolio.pdf.annotation_matching.TextMatch(placement, text, method, edits=None, source_words=None, context='', matched_words=None, source_text='', operations=())[source]
Bases:
objectAn unaccepted placement with its text evidence and alignment edits.
- Parameters:
- placement: adsfolio.pdf.annotation_merge.Placement
- adsfolio.pdf.annotation_matching.source_evidence(item, index)[source]
Read the source text anchor and its original PDF word coordinates.
Notes and shapes use the nearest block, measured by Euclidean rectangle gap. Markup follows the stored quad order, as does its displayed text.
- Parameters:
- Return type:
- adsfolio.pdf.annotation_matching.text_matches(item, index, query=None, offset=(0.0, 0.0), source_words=None)[source]
Find all whole-word occurrences, allowing typography differences.
Repeated occurrences remain separate candidates. Symbol changes are labelled explicitly. Every occurrence still requires visual review.
- Parameters:
query (str | None)
- Return type:
- adsfolio.pdf.annotation_matching.wording_matches(items, source, target, cancelled=<function <lambda>>)[source]
Find each page’s closest wording locally for human review.
Sort by fewest word edits, then most matched words. Keep tied minimal spans on every page. No confidence threshold accepts a placement. If no words match, leave the annotation unresolved. Meaning can still differ.
- Parameters:
cancelled (collections.abc.Callable[[], bool])
- Return type: