From d970ec9d8351f1cbb624f92fba4b33d957014a38 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Fri, 9 Sep 2022 16:34:41 -0600 Subject: [PATCH] Make W|A obfuscator more robust --- main.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/main.py b/main.py index 8fdf465..df1250c 100755 --- a/main.py +++ b/main.py @@ -154,14 +154,10 @@ def think_send(query): result = result.replace('Stephen Wolfram', 'Tanner') # lol result = result.replace('and his team', '') - if '(according to' in result: - result = result.split('(according to')[0] - - if '(asked' in result: - result = result.split('(asked')[0] - - if '(although' in result: - result = result.split('(although')[0] + for word in ['according to', 'asked', 'although', 'approximately']: + idx = result.lower().find('('+word) + if idx > 0: + result = result[:idx-1] if result == 'Error': result = 'INSUFFICIENT DATA FOR A MEANINGFUL ANSWER.'