MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / _query_overlap_terms

Function _query_overlap_terms

uncommon_route/semantic.py:278–288  ·  view source on GitHub ↗
(candidate: str, query_text: str)

Source from the content-addressed store, hash-verified

276
277
278def _query_overlap_terms(candidate: str, query_text: str) -> int:
279 if not query_text.strip():
280 return 0
281 query_terms = {
282 term for term in re.findall(r"[a-zA-Z_][a-zA-Z0-9_/-]{2,}", query_text.lower())
283 if term not in {"the", "and", "for", "with", "that", "this", "from", "into"}
284 }
285 if not query_terms:
286 return 0
287 candidate_terms = set(re.findall(r"[a-zA-Z_][a-zA-Z0-9_/-]{2,}", candidate.lower()))
288 return len(query_terms & candidate_terms)

Callers 1

score_semantic_qualityFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected