1
0
mirror of https://github.com/chubin/cheat.sh.git synced 2026-06-20 21:26:44 +02:00

dashes in the query

This commit is contained in:
Igor Chubin
2018-09-23 19:13:13 +00:00
parent 7771269f49
commit 036f620731
+6 -1
View File
@@ -282,7 +282,12 @@ def _get_answer_for_question(topic):
Find answer for the `topic` question.
"""
topic_words = topic.replace('+', ' ').strip().split()
topic_words = topic.replace('+', ' ').strip()
# some clients send queries with - instead of + so we have to rewrite them to
topic = re.sub(r"(?<!-)-", ' ', topic)
topic_words = topic.split()
topic = " ".join(topic_words)
lang = 'en'