feat: add anonymized infringement batch reporting

This commit is contained in:
HyeongBaeYang committed 2026-09-02 09:23:45 +09:00
1 parent d5e0f4346d
commit c35c5aabfc
6 files changed
+573 -30

No files matched your search

+25
View File
@@ -67,3 +67,28 @@ def test_long_query_finds_middle_copy_without_dilution(tmp_path):
assert hit.segment_id == "seg-1"
assert hit.longest_span >= 100
assert hit.evidence[0]["start"] > 1000
def test_index_excludes_same_document_and_source_group_before_ranking(tmp_path):
db = tmp_path / "corpus.sqlite3"
store = CorpusStore(db)
copied = "바닷가 마을에서 파도 소리를 들으며 자란 기억이 아직도 선명하다."
store.upsert_documents([
DocumentRecord(document_id="doc-self", title="나", metadata={"author_group": "author:a"}),
DocumentRecord(document_id="doc-same-author", title="같은 작성자", metadata={"source_group": "author:a"}),
DocumentRecord(document_id="doc-other", title="다른 작성자", metadata={"source_group": "author:b"}),
])
store.add_segments([
SegmentRecord("seg-self", "doc-self", copied, "1"),
SegmentRecord("seg-same", "doc-same-author", copied, "1"),
SegmentRecord("seg-other", "doc-other", copied + " 다른 결말입니다.", "1"),
])
index = PersistentCorpusIndex(db, tmp_path / "index")
index.sync()
hits = index.query(
copied, top_k=5,
exclude_document_ids={"doc-self"},
exclude_source_groups={"author:a"},
)
assert [hit.document_id for hit in hits] == ["doc-other"]