j-js commited on
Commit
138a82b
·
verified ·
1 Parent(s): 55b1e0c

Update retrieval_engine.py

Browse files
Files changed (1) hide show
  1. retrieval_engine.py +12 -3
retrieval_engine.py CHANGED
@@ -55,11 +55,20 @@ class RetrievalEngine:
55
  rows.append(
56
  {
57
  "text": item.get("text", ""),
58
- "topic": item.get("topic", item.get("section", "general")) or "general",
59
- "source": item.get("source", "local_corpus"),
 
 
 
 
 
 
 
 
 
 
60
  }
61
  )
62
- return rows
63
 
64
  def _topic_bonus(self, desired_topic: str, row_topic: str, intent: str) -> float:
65
  desired_topic = (desired_topic or "").lower()
 
55
  rows.append(
56
  {
57
  "text": item.get("text", ""),
58
+ "topic": (
59
+ item.get("topic")
60
+ or item.get("topic_guess")
61
+ or item.get("section")
62
+ or "general"
63
+ ),
64
+ "source": (
65
+ item.get("source")
66
+ or item.get("source_name")
67
+ or item.get("source_file")
68
+ or "local_corpus"
69
+ ),
70
  }
71
  )
 
72
 
73
  def _topic_bonus(self, desired_topic: str, row_topic: str, intent: str) -> float:
74
  desired_topic = (desired_topic or "").lower()