Automático: a study no line marks is routed by the words its documents share

This commit is contained in:
Roberto Treviño
2026-12-04 14:59:24 -06:00
parent e3c700a1ad
commit 69f5c20e2f
3 changed files with 50 additions and 4 deletions
+17
View File
@@ -53,3 +53,20 @@ def test_a_phrase_the_model_tidied_still_finds_what_the_document_writes():
cervix = {"label": "Biopsia cervical", "documents": [1, 3], "marker": "CÉRVIX, BIOPSIA"}
found = apart(cervix, shown, {2, 4}, print) # written without its accent in C
assert [marks(found, r["text"]) for r in shown] == [True, False, True, False]
def test_a_study_no_line_marks_is_marked_by_the_words_its_documents_share():
"""Each side writes its own specimen line (MAMA DERECHA, MAMA IZQUIERDA) and the model
names the documents without a phrase: the word they all write marks them."""
cervix = "ESTUDIO PATOLOGICO\nNOMBRE: {n}\n1 - BIOPSIA DIRIGIDA POR COLPOSCOPIA DE {c}"
breast = "ESTUDIO PATOLOGICO\nNOMBRE: {n}\nDx: {dx}\n1 - BIOPSIA CON AGUJA DE CORTE DE {s}"
shown = docs([cervix.format(n="A", c="CÉRVIX"), cervix.format(n="B", c="CERVIX"),
breast.format(n="C", dx="CA DE MAMA", s="MAMA DERECHA"),
breast.format(n="D", dx="NÓDULO MAMARIO", s="MAMA IZQUIERDA")]) # fmt: skip
mama = {"label": "Biopsia de mama", "documents": [3, 4], "marker": None}
found = apart(mama, shown, {1, 2}, print)
assert [marks(found, r["text"]) for r in shown] == [False, False, True, True]
assert "M" in found and "AGUJA" not in found # the study's own word, before any other
cervical = {"label": "Biopsia cervical", "documents": [1, 2], "marker": None}
found = apart(cervical, shown, {3, 4}, print) # CÉRVIX and CERVIX alike
assert [marks(found, r["text"]) for r in shown] == [True, True, False, False]