From cdb3e6434afeb6a0309298a62b8edf602b92fcb0 Mon Sep 17 00:00:00 2001 From: Kevin Hu Date: Fri, 21 Feb 2025 15:47:39 +0800 Subject: [PATCH] Fix empty question issue. (#5225) ### What problem does this PR solve? #5241 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- rag/nlp/query.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rag/nlp/query.py b/rag/nlp/query.py index aa79496e..f5299400 100644 --- a/rag/nlp/query.py +++ b/rag/nlp/query.py @@ -63,8 +63,11 @@ class FulltextQueryer: r"(^| )('s|'re|is|are|were|was|do|does|did|don't|doesn't|didn't|has|have|be|there|you|me|your|my|mine|just|please|may|i|should|would|wouldn't|will|won't|done|go|for|with|so|the|a|an|by|i'm|it's|he's|she's|they|they're|you're|as|by|on|in|at|up|out|down|of|to|or|and|if) ", " ") ] + otxt = txt for r, p in patts: txt = re.sub(r, p, txt, flags=re.IGNORECASE) + if not otxt: + txt = otxt return txt def question(self, txt, tbl="qa", min_match: float = 0.6):