rag.core.passage¶

Passage selection helpers shared by RAG backends.

Attributes¶

Functions¶

is_author_question(→ bool)

Return True when the question is asking who wrote a paper.

is_acknowledgement_text(→ bool)

Return True when text looks like thanks / manuscript revision notes.

is_proceedings_boilerplate_text(→ bool)

Return True when text is SPIE copyright / volume-editor footer.

page_from_mapping(→ int | None)

Read a 1-based page number from chunk metadata.

Module Contents¶

rag.core.passage.AUTHOR_QUESTION_CUES: Final = ('who wrote', 'who is the writer', 'who is the author', 'who are the authors', 'who is the main...[source]¶
rag.core.passage.ACKNOWLEDGEMENT_CUES: Final = ('acknowledg', 'thanks to', 'thank ', 'grateful to', 'careful revision', 'revising the...[source]¶
rag.core.passage.PROCEEDINGS_BOILERPLATE_CUES: Final = ('edited by', 'proc. of spie', 'ccc code', 'spiedigitallibrary', 'terms of use')[source]¶
rag.core.passage.QA_GROUNDING_RULES: Final = "People thanked for revising a manuscript are not authors. SPIE 'edited by' names are volume...[source]¶
rag.core.passage.is_author_question(*, question: str) bool[source]¶

Return True when the question is asking who wrote a paper.

Parameters:

question (str) – User question.

Returns:

True when authorship cues are present.

Return type:

bool

rag.core.passage.is_acknowledgement_text(*, text: str) bool[source]¶

Return True when text looks like thanks / manuscript revision notes.

Parameters:

text (str) – Chunk or page text.

Returns:

True when acknowledgement phrasing dominates authorship lists.

Return type:

bool

rag.core.passage.is_proceedings_boilerplate_text(*, text: str) bool[source]¶

Return True when text is SPIE copyright / volume-editor footer.

Parameters:

text (str) – Chunk or page text.

Returns:

True when proceedings chrome is present.

Return type:

bool

rag.core.passage.page_from_mapping(*, metadata: dict[str, Any]) int | None[source]¶

Read a 1-based page number from chunk metadata.

Parameters:

metadata (dict) – Loader metadata.

Returns:

Page number when parseable.

Return type:

int or None