import asyncio import sys sys.path.insert(0, ".") from services.neo4j_service import Neo4jService from services.paper_recommender import PaperRecommender async def main(): neo4j = Neo4jService() rows = neo4j.run( "MATCH (c:Claim {doc_id: $doc_id}) RETURN c.text AS text, c.claim_id AS cid " "ORDER BY c.composite_score DESC LIMIT 5", doc_id="doc_65382c73", ) kw = [ r["term"] for r in neo4j.run( "MATCH (k:Keyword {doc_id: $doc_id}) RETURN k.term AS term " "ORDER BY k.score DESC LIMIT 15", doc_id="doc_65382c73", ) if r.get("term") ] print("KEYWORDS:", kw[:10]) pr = PaperRecommender() for row in rows: t = row["text"] print("---", row["cid"], "|", t[:90]) recs = await pr.search_web(t, limit=4, keywords=kw) print(" search_web:", len(recs)) for r in recs[:3]: print(" >", r.get("source"), "|", (r.get("title") or "")[:55], "| abs:", bool(r.get("abstract"))) asyncio.run(main())