MCPcopy
hub / github.com/PDFMathTranslate/PDFMathTranslate / __init__

Method __init__

pdf2zh/translator.py:171–177  ·  view source on GitHub ↗
(self, lang_in, lang_out, model, ignore_cache=False, **kwargs)

Source from the content-addressed store, hash-verified

169 lang_map = {"zh": "zh-CN"}
170
171 def __init__(self, lang_in, lang_out, model, ignore_cache=False, **kwargs):
172 super().__init__(lang_in, lang_out, model, ignore_cache)
173 self.session = requests.Session()
174 self.endpoint = "https://translate.google.com/m"
175 self.headers = {
176 "User-Agent": "Mozilla/4.0 (compatible;MSIE 6.0;Windows NT 5.1;SV1;.NET CLR 1.1.4322;.NET CLR 2.0.50727;.NET CLR 3.0.04506.30)" # noqa: E501
177 }
178
179 def do_translate(self, text):
180 text = text[:5000] # google translate max length

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected