From ab6deab1053132efd360f63e3ad0f169f8b91d4b Mon Sep 17 00:00:00 2001 From: Patrick Hammer Date: Thu, 31 Dec 2020 02:52:47 +0000 Subject: [PATCH] Update: regex fix --- english_to_narsese.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/english_to_narsese.py b/english_to_narsese.py index 1927038a..a514f22d 100755 --- a/english_to_narsese.py +++ b/english_to_narsese.py @@ -76,7 +76,7 @@ def isCommand(sentence): def output(negated, text, replaceQuestionWords=True, command=False): if replaceQuestionWords: for x in questionwords: - text = re.sub(r'[^\W]'+text+"[^\W]", '?1', text) + text = re.sub(r'([^a-zA-Z0-9])(' + x + r')([^a-zA-Z0-9])', r'\1?1\3', text) if command or text.startswith("//"): print(text) #direct print else: