Remove corpus counts from chat chrome
This commit is contained in:
@@ -197,6 +197,34 @@ def test_retrieve_framed_pools_lexically_strong_neighbour_section():
|
||||
]
|
||||
|
||||
|
||||
def test_explicit_dosage_section_does_not_pool_a_lexical_interaction_match():
|
||||
documents = [
|
||||
RetrievalDocument(
|
||||
doc_id=f"paracetamol::{section}::0", drug_id="paracetamol",
|
||||
kind="prose", section_key=section,
|
||||
text=f"Nội dung mục {section}.", source_refs=(SOURCE,),
|
||||
)
|
||||
for section in ("lieu_luong_va_cach_dung", "tuong_tac_thuoc")
|
||||
]
|
||||
interaction = next(d for d in documents if d.section_key == "tuong_tac_thuoc")
|
||||
retriever = _OverviewRetriever(
|
||||
documents, lexical_hits=[SearchHit(interaction, score=10.0)]
|
||||
)
|
||||
service = RetrievalService(retriever, InMemoryParentStore([]), EvidencePolicy())
|
||||
|
||||
result = service.retrieve_framed(
|
||||
"paracetamol", "lieu_luong_va_cach_dung",
|
||||
"Liều uống paracetamol cho người lớn",
|
||||
)
|
||||
|
||||
assert result.decision == EvidenceDecision.ANSWERABLE
|
||||
returned_sections = {
|
||||
evidence.matched_doc_id.split("::")[1] for evidence in result.evidence
|
||||
}
|
||||
assert returned_sections == {"lieu_luong_va_cach_dung"}
|
||||
assert retriever.lexical_calls == []
|
||||
|
||||
|
||||
def test_row_hit_hydrates_complete_parent_and_keeps_citation():
|
||||
result = table_service().retrieve("acetylcystein 45 kg bao nhiêu ml", "acetylcystein")
|
||||
assert result.decision == EvidenceDecision.ANSWERABLE
|
||||
@@ -318,6 +346,18 @@ def test_verified_aliases_reach_common_parenthesized_drug_names():
|
||||
)
|
||||
|
||||
|
||||
def test_autocomplete_prioritizes_canonical_name_over_an_unrelated_trade_alias():
|
||||
resolver = CatalogDrugResolver({
|
||||
"paracetamol_acetaminophen": {"paracetamol", "acetaminophen"},
|
||||
"galantamin": {"paragal"},
|
||||
"metformin": {"metformin"},
|
||||
"alpha_tocopherol_vitamin_e": {"met-alpha"},
|
||||
})
|
||||
|
||||
assert resolver.complete("para", k=2)[0] == "paracetamol_acetaminophen"
|
||||
assert resolver.complete("met", k=2)[0] == "metformin"
|
||||
|
||||
|
||||
def test_verified_catalog_protects_canonical_substring_traps():
|
||||
resolver = CatalogDrugResolver(load_aliases(VERIFIED_ENTITIES))
|
||||
traps = {
|
||||
|
||||
Reference in New Issue
Block a user