diff --git a/LunaTranslator/LunaTranslator/cishu/yomichan.py b/LunaTranslator/LunaTranslator/cishu/yomichan.py deleted file mode 100644 index 88f0d035..00000000 --- a/LunaTranslator/LunaTranslator/cishu/yomichan.py +++ /dev/null @@ -1,42 +0,0 @@ -import os -import requests -from urllib.parse import quote -import re, json -from myutils.proxy import getproxy -from cishu.cishubase import cishubase - - -class yomichan(cishubase): - def init(self): - self.sql = None - - path = self.config["path"] - self.datas = [] - for f in os.listdir(path): - if f.startswith("term_bank_") and f.endswith(".json"): - with open(os.path.join(path, f), "r", encoding="utf8") as ff: - self.datas += json.loads(ff.read()) - - def search(self, word): - results = [] - diss = {} - import winsharedutils - - for item in self.datas: - dis = winsharedutils.distance(item[0], word) - if dis <= self.config["distance"]: - results.append(item) - diss[item[0]] = dis - if len(results) == 0: - return - results = sorted(results, key=lambda x: diss[x[0]]) - - html = "" - for item in results: - word = item[0] - hira = item[1] - explain = item[5][0].replace("\n", "
") - html += f'{word}{hira}{explain}' - html = f"{html}
" - # print(html) - return html diff --git a/LunaTranslator/files/defaultconfig/config.json b/LunaTranslator/files/defaultconfig/config.json index cfbf121a..c96bfc67 100644 --- a/LunaTranslator/files/defaultconfig/config.json +++ b/LunaTranslator/files/defaultconfig/config.json @@ -1023,36 +1023,6 @@ } } }, - "yomichan": { - "use": false, - "name": "yomichan termbank", - "args": { - "path": "", - "distance": 0, - "priority": 100 - }, - "argstype": { - "path": { - "type": "file", - "name": "路径", - "dir": true - }, - "distance": { - "type": "intspin", - "name": "模糊匹配_编辑距离", - "min": 0, - "max": 100, - "step": 1 - }, - "priority": { - "type": "intspin", - "name": "优先级", - "min": 0, - "max": 10000, - "step": 1 - } - } - }, "goo": { "use": false, "name": "goo",