Wire the guarded conversational RAG answer layer end-to-end
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
from ingestion.extract.models import Span
|
||||
from ingestion.segment.detector import detect_monograph_titles, detect_section_headings
|
||||
from ingestion.segment.detector import (
|
||||
detect_monograph_titles,
|
||||
detect_section_headings,
|
||||
in_monograph_range,
|
||||
)
|
||||
|
||||
|
||||
def _span(text, physical_page, printed_page, y0=100.0, bold=True, size=10.0):
|
||||
@@ -86,3 +90,12 @@ def test_unknown_bold_text_not_matched_as_section():
|
||||
def test_section_heading_outside_monograph_range_excluded():
|
||||
spans = [_span("Chỉ định", 5, 6, bold=True, size=9.5)]
|
||||
assert list(detect_section_headings(spans)) == []
|
||||
|
||||
|
||||
def test_back_index_cannot_reenter_range_via_bad_inferred_printed_page():
|
||||
# Confirmed real failure: physical page 1655 of the back index was mapped
|
||||
# to printed page 1496, making its "Tương tác thuốc" entry extend
|
||||
# ZOLPIDEM's source range from page 1494 through page 1655.
|
||||
index_span = _span("Tương tác thuốc", 1655, 1496)
|
||||
assert in_monograph_range(index_span) is False
|
||||
assert list(detect_section_headings([index_span])) == []
|
||||
|
||||
Reference in New Issue
Block a user