(candidate: str, query_text: str)
| 276 | |
| 277 | |
| 278 | def _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) |
no outgoing calls
no test coverage detected