summaryrefslogtreecommitdiff
path: root/rag/test.py
diff options
context:
space:
mode:
Diffstat (limited to 'rag/test.py')
-rw-r--r--rag/test.py39
1 files changed, 23 insertions, 16 deletions
diff --git a/rag/test.py b/rag/test.py
index b7a6d8e..864a3ba 100644
--- a/rag/test.py
+++ b/rag/test.py
@@ -47,29 +47,36 @@ def t():
# db = sqlite3.connect("./rag.db")
queries = [
-"How was Shuihu zhuan received in early modern Japan?",
-"Edo-period readers’ image of Song Jiang / Liangshan outlaws",
-"Channels of transmission for Chinese vernacular fiction into Japan (kanbun kundoku, digests, translations)",
-"Role of woodblock prints/illustrations in mediating Chinese fiction",
-"Key Japanese scholars, writers, or publishers who popularized Chinese fiction",
-"Kyokutei Bakin’s engagement with Chinese vernacular narrative",
-"Santō Kyōden, gesaku, and Chinese models",
-"Kanzen chōaku (encourage good, punish evil) and Water Margin in Japan",
-"Moral ambivalence of outlaw heroes as discussed in the text",
-"Censorship or moral debates around reading Chinese fiction",
-"Translation strategies from vernacular Chinese to Japanese (furigana, kundoku, glossing)",
-"Paratexts: prefaces, commentaries, reader guidance apparatus",
-"Bibliographic details: editions, reprints, circulation networks",
-"How does this book challenge older narratives about Sino-Japanese literary influence?",
-"Methodology: sources, archives, limitations mentioned by the author",
+# "How was Shuihu zhuan received in early modern Japan?",
+# "Edo-period readers’ image of Song Jiang / Liangshan outlaws",
+# "Channels of transmission for Chinese vernacular fiction into Japan (kanbun kundoku, digests, translations)",
+# "Role of woodblock prints/illustrations in mediating Chinese fiction",
+# "Key Japanese scholars, writers, or publishers who popularized Chinese fiction",
+# "Kyokutei Bakin’s engagement with Chinese vernacular narrative",
+# "Santō Kyōden, gesaku, and Chinese models",
+# "Kanzen chōaku (encourage good, punish evil) and Water Margin in Japan",
+# "Moral ambivalence of outlaw heroes as discussed in the text",
+# "Censorship or moral debates around reading Chinese fiction",
+# "Translation strategies from vernacular Chinese to Japanese (furigana, kundoku, glossing)",
+# "Paratexts: prefaces, commentaries, reader guidance apparatus",
+# "Bibliographic details: editions, reprints, circulation networks",
+# "How does this book challenge older narratives about Sino-Japanese literary influence?",
+# "Methodology: sources, archives, limitations mentioned by the author",
+"sex"
]
def t2():
db = get_db()
# Hybrid + CE rerank query:
+ model = rag.ingest.get_embed_model()
for query in queries:
print("query", query)
- results = rag.search.search_hybrid(db, query, k_vec=50, k_bm25=50, k_final=8)
+ print("-----------\n\n")
+ # results = rag.search.search_hybrid(db, "muh", query, k_vec=50, k_bm25=50, k_final=8)
+ # for rid, txt, score in results:
+ # sim = score
+ # print(f"[{rid:04d}] ce_score={sim:.3f}\n{txt[:300]}...\n")
+ results = rag.search.vec_search(db, model, "muh", query, k=50, min_sim=0.25, max_per_doc=5, use_mmr=False, mmr_lambda=0.7)
for rid, txt, score in results:
sim = score
print(f"[{rid:04d}] ce_score={sim:.3f}\n{txt[:300]}...\n")