crexs commited on
Commit
60cad3a
·
verified ·
1 Parent(s): 2905e88

sync: update core/unified_memory.py

Browse files
Files changed (1) hide show
  1. core/unified_memory.py +11 -0
core/unified_memory.py CHANGED
@@ -200,6 +200,17 @@ class MemoryManager:
200
 
201
  t_hours = max(0, (now - ts).total_seconds() / 3600.0)
202
  sim_score = max(0.0, 1.0 - (dist * dist) / 2.0)
 
 
 
 
 
 
 
 
 
 
 
203
 
204
  e_score = float(meta.get("emotion_intensity", meta.get("emotional", 0.5)))
205
  g_score = float(meta.get("importance", meta.get("goal", 0.5)))
 
200
 
201
  t_hours = max(0, (now - ts).total_seconds() / 3600.0)
202
  sim_score = max(0.0, 1.0 - (dist * dist) / 2.0)
203
+ boost = 0.0
204
+ try:
205
+ import re
206
+ query_words = set(re.findall(r"\b\w{3,}\b", query.lower()))
207
+ content_words = set(re.findall(r"\b\w{3,}\b", row["content"].lower()))
208
+ overlap = query_words.intersection(content_words)
209
+ if query_words:
210
+ boost = 0.2 * (len(overlap) / len(query_words))
211
+ except Exception:
212
+ pass
213
+ sim_score = min(1.0, sim_score + boost)
214
 
215
  e_score = float(meta.get("emotion_intensity", meta.get("emotional", 0.5)))
216
  g_score = float(meta.get("importance", meta.get("goal", 0.5)))