From 7ce14a3d2f66200a6ca890a89e2f1eccec1bf00e Mon Sep 17 00:00:00 2001 From: arsam Date: Fri, 18 Sep 2026 23:06:30 +0330 Subject: [PATCH] Import source: axon/services/citations Import the existing local project snapshot. This commit organizes existing files; it does not represent newly developed functionality. --- axon/services/citations.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 axon/services/citations.py diff --git a/axon/services/citations.py b/axon/services/citations.py new file mode 100644 index 0000000..05c94e8 --- /dev/null +++ b/axon/services/citations.py @@ -0,0 +1,11 @@ +import re + +from axon.models import SearchResult + +_CITATION_RE = re.compile(r"\[(\d+)\]") + + +def validate_citations(report: str, sources: list[SearchResult]) -> tuple[int, list[int], bool]: + citations = sorted({int(match) for match in _CITATION_RE.findall(report)}) + missing = [citation for citation in citations if citation < 1 or citation > len(sources)] + return len(citations), missing, not missing and bool(citations)