From 36e75b331739d180a4b37bb9617be65d50e8a100 Mon Sep 17 00:00:00 2001 From: Kevin Hu Date: Wed, 20 Nov 2024 09:38:54 +0800 Subject: [PATCH] fix synonym bug (#3506) ### What problem does this PR solve? ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- rag/nlp/synonym.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rag/nlp/synonym.py b/rag/nlp/synonym.py index 0c7721da6..1a9a3f533 100644 --- a/rag/nlp/synonym.py +++ b/rag/nlp/synonym.py @@ -68,7 +68,7 @@ class Dealer: def lookup(self, tk): if re.match(r"[a-z]+$", tk): - res = list(set([re.sub("_", " ", syn.name().split(".")[0]) for syn in wordnet.synsets("love")]) - set([tk])) + res = list(set([re.sub("_", " ", syn.name().split(".")[0]) for syn in wordnet.synsets(tk)]) - set([tk])) return [t for t in res if t] self.lookup_num += 1