diff --git a/lib/adapter/question.py b/lib/adapter/question.py index 8153a4c9..27f63a38 100644 --- a/lib/adapter/question.py +++ b/lib/adapter/question.py @@ -12,9 +12,6 @@ import re from subprocess import Popen, PIPE -from polyglot.detect import Detector -from polyglot.detect.base import UnknownLanguage - from config import CONFIG from languages_data import SO_NAME from .upstream import UpstreamAdapter @@ -83,40 +80,7 @@ def _get_page(self, topic, request_options=None): topic_words = topic.split() topic = " ".join(topic_words) - - lang = "en" - try: - query_text = topic # " ".join(topic) - query_text = re.sub("^[^/]*/+", "", query_text.rstrip("/")) - query_text = re.sub("/[0-9]+$", "", query_text) - query_text = re.sub("/[0-9]+$", "", query_text) - detector = Detector(query_text) - supposed_lang = detector.languages[0].code - if len(topic_words) > 2 or supposed_lang in [ - "az", - "ru", - "uk", - "de", - "fr", - "es", - "it", - "nl", - ]: - lang = supposed_lang - if supposed_lang.startswith("zh_") or supposed_lang == "zh": - lang = "zh" - elif supposed_lang.startswith("pt_"): - lang = "pt" - if supposed_lang in ["ja", "ko"]: - lang = supposed_lang - - except UnknownLanguage: - print("Unknown language (%s)" % query_text) - - if lang != "en": - topic = ["--human-language", lang, topic] - else: - topic = [topic] + topic = [topic] cmd = [CONFIG["path.internal.bin.upstream"]] + topic proc = Popen(cmd, stdin=open(os.devnull, "r"), stdout=PIPE, stderr=PIPE) diff --git a/requirements.txt b/requirements.txt index ca907c94..b816d872 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,11 +7,7 @@ dateutils fuzzywuzzy redis colored<1.4.3 -langdetect cffi -polyglot -PyICU -pycld2 colorama pyyaml python-Levenshtein