Translators - is a library which aims to bring free, multiple, enjoyable translation to individuals and students in Python

Overview

PyPI - Version PyPI - License PyPI - Python PyPI - Status PyPI - Wheel Downloads


Translators is a library which aims to bring free, multiple, enjoyable translation to individuals and students in Python. It based on the translation interface of Google, Yandex, Microsoft(Bing), Baidu, Alibaba, Tencent, NetEase(Youdao), Sogou, Kingsoft(Iciba), Iflytek, Deepl, Caiyun, Argos, etc.

Installation

From PyPI

# Windows, Mac, Linux
pip install translators --upgrade

# Linux javascript runtime environment:
sudo yum -y install nodejs

From Source

git clone https://github.com/UlionTse/translators.git
cd translators
python setup.py install

Getting Started

import translators as ts

wyw_text = '季姬寂,集鸡,鸡即棘鸡。棘鸡饥叽,季姬及箕稷济鸡。'
chs_text = '季姬感到寂寞,罗集了一些鸡来养,鸡是那种出自荆棘丛中的野鸡。野鸡饿了唧唧叫,季姬就拿竹箕中的谷物喂鸡。'
html_text = '''



	这是标题


这是文章《你的父亲》

''' ## language # input languages print(ts.google(wyw_text)) # default: from_language='auto', to_language='en' # output language_map print(ts._google.language_map) ## professional field print(ts.alibaba(wyw_text, professional_field='general')) # ("general","message","offer") print(ts.baidu(wyw_text, professional_field='common')) # ('common','medicine','electronics','mechanics') print(ts.caiyun(wyw_text, from_language='zh', professional_field=None)) # ("medicine","law","machinery") ## property rs = [ts.tencent(x) for x in [wyw_text, chs_text]] print(ts._tencent.query_count) print(dir(ts._tencent)) ## requests print(ts.youdao(wyw_text, sleep_seconds=5, timeout=None, proxies=None)) ## host # cn print(ts.google(wyw_text, if_use_cn_host=True)) print(ts.bing(wyw_text, if_use_cn_host=False)) # reset host print(ts.google(wyw_text, reset_host_url=None)) print(ts.yandex(wyw_text, reset_host_url=None)) ## detail result print(ts.sogou(wyw_text, is_detail_result=True)) ## translate html print(ts.translate_html(html_text, translator=ts.google, to_language='en', n_jobs=-1)) ## others print(ts._argos.host_pool) print(ts.argos(wyw_text, reset_host_url=None)) ## help help(ts.google)

Issues

Linux Runtime Environment

  1. To support javascript runtime environment, you should sudo yum -y install nodejs .
  2. PS, ts.baidu() does not work on Linux without desktop.

Supported Country and Region Service

  1. If you have requests error, please check whether this service is provided in your country or region.
  2. Check the website about eg: help(ts.google).

HttpError 4xx

  1. Please check whether you made high frequency requests.
  2. Please check whether this service is provided in your country or region.
  3. Detail to solve HttpError itself.
  4. Please issue me, thanks.

RequestsError or ProxyError

  1. Check whether the advanced version of requests you have installed can access the site properly. If not, try lowering the version or otherwise.
  2. Check that agents are enabled on your computer. If it is enabled, try turning it off or otherwise.

More About Translators

Features

Translator Number of Supported Languages Advantage
Iciba 187 support the most languages in the world
Google 109 support more languages in the world
Bing 102 support more languages in the world
Yandex 100 support more languages in the world, support word to emoji
Iflytek 70 support more languages in the world
Sogou 61 support more languages in the world
Baidu 28 support main languages, support professional field
Deepl 24 high quality to translate but response slowly
Tencent 17 support main languages
Argos 17 support main languages , open-source
Youdao 15 support main languages, high quality
Alibaba 12 support main languages, support professional field
Caiyun 6 high quality to translate but response slowly, support professional field

Support Language

Language Language of Translator Google Yandex Bing Baidu Alibaba Tencent Youdao Sogou Deepl Caiyun Argos Iciba Iflytek
english en Y Y Y Y Y Y Y Y Y Y Y ... ...
chinese zh Y Y Y Y Y Y Y Y Y Y Y
arabic ar Y Y Y Y(ara) Y Y Y Y Y
russian ru Y Y Y Y Y Y Y Y Y Y Y
french fr Y Y Y Y(fra) Y Y Y Y Y Y Y
german de Y Y Y Y Y Y Y Y Y
spanish es Y Y Y Y(spa) Y Y Y Y Y Y Y
portuguese pt Y Y Y(pt/pt-pt) Y Y Y Y Y Y Y
italian it Y Y Y Y Y Y Y Y Y Y
japanese ja Y Y Y Y(jp) Y Y Y Y Y Y
korean ko Y Y Y Y(kor) Y Y Y Y
greek el Y Y Y Y Y Y
dutch nl Y Y Y Y Y Y Y
hindi hi Y Y Y Y Y Y
turkish tr Y Y Y Y Y Y Y
malay ms Y Y Y Y Y
thai th Y Y Y Y Y Y Y
vietnamese vi Y Y Y Y(vie) Y Y Y Y Y
indonesian id Y Y Y Y Y Y Y Y
hebrew he Y(iw) Y Y Y
polish pl Y Y Y Y Y Y Y
mongolian mn Y Y Y(nm)
czech cs Y Y Y Y Y Y
hungarian hu Y Y Y Y Y Y
estonian et Y Y Y Y(est) Y Y
bulgarian bg Y Y Y Y(bul) Y Y
danish da Y Y Y Y(dan) Y Y
finnish fi Y Y Y Y(fin) Y Y
romanian ro Y Y Y Y(rom) Y Y
swedish sv Y Y Y Y(swe) Y Y
slovenian sl Y Y Y Y(slo) Y Y
persian/farsi fa Y Y Y Y
bosnian bs Y Y Y(bs-Latn) Y(bs-Latn)
serbian sr Y Y Y(sr-Latn/sr-Cyrl) Y(sr-Latn/sr-Cyrl)
fijian fj Y Y
filipino tl Y Y Y(fil) Y(fil)
haitiancreole ht Y Y Y Y
catalan ca Y Y Y Y
croatian hr Y Y Y Y
latvian lv Y Y Y Y Y
lithuanian lt Y Y Y Y Y
urdu ur Y Y Y Y
ukrainian uk Y Y Y Y
welsh cy Y Y Y Y
tahiti ty Y Y
tongan to Y Y
swahili sw Y Y Y Y
samoan sm Y Y Y
slovak sk Y Y Y Y Y
afrikaans af Y Y Y Y
norwegian no Y Y Y Y
bengali bn Y Y Y(bn-BD) Y
malagasy mg Y Y Y Y
maltese mt Y Y Y Y
queretaro otomi otq Y Y
klingon/tlhingan hol tlh Y Y
gujarati gu Y Y Y
tamil ta Y Y Y
telugu te Y Y Y
punjabi pa Y Y Y
amharic am Y Y
azerbaijani az Y Y
bashkir ba Y
belarusian be Y Y
cebuano ceb Y Y
chuvash cv Y
esperanto eo Y Y
basque eu Y Y
irish ga Y Y Y
emoji emj Y
... ...

More supported language, eg:

# request once first, then:
print(ts._google.language_map)

About Chinese Language

Language Language of Translator Google Yandex Bing Baidu Alibaba Tencent Youdao Sogou Iciba Iflytek Caiyun Deepl Argos
Chinese(简体) zh-CHS Y(zh-CN) Y(zh) Y(zh-Hans) Y(zh) Y(zh) Y(zh) Y Y Y(zh) Y(zh) Y(zh) Y(zh) Y(zh)
Chinese(繁体) zh-CHT Y(zh-TW) Y(zh-Hant) Y(cht) Y(zh-TW) Y Y(cnt)
Chinese(文言文) wyw Y
Chinese(粤语) yue Y Y Y Y Y
Chinese(内蒙语) mn N[外蒙] N[外蒙] Y[内蒙]
Chinese(维吾尔语) uy Y
Chinese(藏语) ti Y
Chinese(白苗文) mww Y Y Y
Chinese(彝语) ii Y

License

MIT Llicense

Comments
  • TranslateError ; cant find language destination bug on google trad

    TranslateError ; cant find language destination bug on google trad

    Hello :) im just getting an error on every of my script with this package used; my box just died one week ago and got repair today. I tried 2 different to_language value and getting this error :

    Using France server backend. type word here :Nath there is as much possibility: 24

    TranslatorError Traceback (most recent call last) in 28 list2.append(1) 29 list3.append(1) ---> 30 list3[P]=trad(str(list1[P])) 31 32 vo=str(list3[P]).lower()

    in trad(t) 7 8 def trad(t): ----> 9 u=ts.google(t,to_language='fr',is_detail_result=False) 10 return u 11

    /var/mobile/Containers/Data/Application/DE79D566-42C7-4545-B9DE-422DDE1F789C/Library/lib/python3.9/site-packages/translators/apis.py in google_api(self, query_text, from_language, to_language, **kwargs) 328 if not self.language_map: 329 self.language_map = self.get_language_map(host_html) --> 330 from_language, to_language = self.check_language(from_language, to_language, self.language_map, output_zh=self.output_zh) 331 332 rpc_data = self.get_rpc(query_text, from_language, to_language)

    /var/mobile/Containers/Data/Application/DE79D566-42C7-4545-B9DE-422DDE1F789C/Library/lib/python3.9/site-packages/translators/apis.py in check_language(from_language, to_language, language_map, output_zh, output_auto) 101 raise TranslatorError('Unsupported from_language[{}] in {}.'.format(from_language,sorted(language_map.keys()))) 102 elif to_language not in language_map: --> 103 raise TranslatorError('Unsupported to_language[{}] in {}.'.format(to_language,sorted(language_map.keys()))) 104 elif from_language != output_auto and to_language not in language_map[from_language]: 105 logger.exception('language_map:', language_map)

    TranslatorError: Unsupported to_language[fr] in [].

    Thanks mate

    bug solved code robustness sever itself limited 
    opened by ObedH26 18
  • `translators` doesn't work with Heroku

    `translators` doesn't work with Heroku

    I get this error:

     Traceback (most recent call last):
       File "<string>", line 1, in <module>
       File "/tmp/pip-req-build-ritdm4zu/setup.py", line 14, in <module>
         VERSION = __import__(PACKAGE).__version__
       File "/tmp/pip-req-build-ritdm4zu/translators/__init__.py", line 4, in <module>
         from translators.apis import alibaba, argos, baidu, bing, caiyun, deepl, google, iciba, iflytek, sogou, tencent, yandex, youdao
       File "/tmp/pip-req-build-ritdm4zu/translators/apis.py", line 50, in <module>
         import pathos.multiprocessing
     ModuleNotFoundError: No module named 'pathos'
    

    This is in my requirements.txt:

    git+https://github.com/uliontse/translators
    
    need other help solved 
    opened by Infiniticity 13
  • Issues with Niutrans, Iflytek, Yandex, Alibaba

    Issues with Niutrans, Iflytek, Yandex, Alibaba

    I decided to test out all the translation services in this library and found that some of them aren't working.

    First I imported the library and got some text from the example:

    >>> import translators as ts
    Using state Moscow server backend.
    >>> a = '季姬寂,集鸡,鸡即棘鸡。棘鸡饥叽,季姬及箕稷济鸡。'
    

    Then I started testing. This is the issue with Niutrans:

    >>> ts.niutrans(a)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/home/etile/.local/lib/python3.10/site-packages/translators/apis.py", line 2383, in niutrans_api
        self.account_info = {**guest_info, **token_data['data']}
    KeyError: 'data'
    

    The same error appears for Iflytech:

    >>> ts.iflytek(a)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/home/etile/.local/lib/python3.10/site-packages/translators/apis.py", line 1764, in iflytek_api
        return data if is_detail_result else eval(data['data'])['trans_result']['dst']
    KeyError: 'data'
    

    Yandex has a different issue. It says that the website is forbidden, although I can access it and use it just fine with my browser: ( Referenced by #94 )

    >>> ts.yandex(a)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/home/etile/.local/lib/python3.10/site-packages/translators/apis.py", line 1418, in yandex_api
        r.raise_for_status()
      File "/usr/lib/python3.10/site-packages/requests/models.py", line 1021, in raise_for_status
        raise HTTPError(http_error_msg, response=self)
    requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://translate.yandex.com/
    

    Alibaba has the most complicated error:

    >>> ts.alibaba(a)
    Traceback (most recent call last):
      File "/home/etile/.local/lib/python3.10/site-packages/translators/apis.py", line 847, in get_language_map
        return _get_lang(self.get_language_new_url, params=None)
      File "/home/etile/.local/lib/python3.10/site-packages/translators/apis.py", line 842, in _get_lang
        language_map = dict(map(lambda x: x, [(x['sourceLuange'], x['targetLanguages']) for x in language_dict['languageMap']]))
    KeyError: 'languageMap'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/home/etile/.local/lib/python3.10/site-packages/translators/apis.py", line 883, in alibaba_api
        self.language_map = self.get_language_map(ss, use_domain, dmtrack_pageid, timeout, proxies)
      File "/home/etile/.local/lib/python3.10/site-packages/translators/apis.py", line 849, in get_language_map
        return _get_lang(self.get_language_old_url, params=params)
      File "/home/etile/.local/lib/python3.10/site-packages/translators/apis.py", line 842, in _get_lang
        language_map = dict(map(lambda x: x, [(x['sourceLuange'], x['targetLanguages']) for x in language_dict['languageMap']]))
    KeyError: 'languageMap'
    

    I would also like to thank you for making this library. It has been a massive help in my projects.

    solved sever itself limited bug after translation server changes lack of information 
    opened by Etile0 9
  • Make source distribution releases available

    Make source distribution releases available

    I've been using this package for some research recently, so it would be very useful for this package to be available in on Conda Forge so it can be used in Anaconda properly. However, for the conda recipe to work, it either needs the source distribution (from setup.py sdist) to be uploaded to PyPI or it needs releases to be made for versions on GitHub. Currently this package has neither so it's not possible to create a Conda recipe. It would be much appreciated if one of those steps could be taken!

    solved good idea 
    opened by freddyheppell 9
  • ‘NoneType’ object is not iterable

    ‘NoneType’ object is not iterable

    I have this error in some case, For example if i give one letter,all the letter will work normally , its will gimme translate but if i give the "a" letter i got the following error. Or someword give me the same error during the search generally during the translate of 100/200th word sometime less sometime more .

    type word here :A there is as much possibility: 1

    TypeError Traceback (most recent call last) in 28 list2.append(1) 29 list3.append(1) ---> 30 list3[P]=trad(str(list1[P])) 31 32 vo=(list3[P]).lower()

    in trad(t) 7 8 def trad(t): ----> 9 u=ts.google(t,to_language='fr') 10 return u 11

    /var/mobile/Containers/Data/Application/DE79D566-42C7-4545-B9DE-422DDE1F789C/Library/lib/python3.9/site-packages/translators/apis.py in google_api(self, query_text, from_language, to_language, **kwargs) 338 time.sleep(sleep_seconds) 339 self.query_count += 1 --> 340 return data if is_detail_result else ''.join([x[0] for x in data[1][0][0][5]]) 341 342

    TypeError: 'NoneType' object is not iterable

    good question solved 
    opened by ObedH26 9
  • Build and install fails in Python 3.11

    Build and install fails in Python 3.11

    The translators module doesn't build and install properly on Python 3.11, and it seems to be a dependency issue; specifically, lxml. Here's the Windows traceback.

    PS C:\Users\preri\Desktop> test\Scripts\python -V
    Python 3.11.0
    PS C:\Users\preri\Desktop> test\Scripts\pip install -U translators --no-cache-dir
    Collecting translators
      Downloading translators-5.4.8-py3-none-any.whl (30 kB)
    Collecting requests>=2.28.1
      Downloading requests-2.28.1-py3-none-any.whl (62 kB)
         ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.8/62.8 kB ? eta 0:00:00
    Collecting PyExecJS>=1.5.1
      Downloading PyExecJS-1.5.1.tar.gz (13 kB)
      Preparing metadata (setup.py) ... done
    Collecting lxml>=4.9.1
      Downloading lxml-4.9.1.tar.gz (3.4 MB)
         ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.4/3.4 MB 71.6 MB/s eta 0:00:00
      Preparing metadata (setup.py) ... done
    Collecting pathos>=0.2.9
      Downloading pathos-0.3.0-py3-none-any.whl (79 kB)
         ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 79.8/79.8 kB ? eta 0:00:00
    Collecting cryptography>=38.0.1
      Downloading cryptography-38.0.1-cp36-abi3-win_amd64.whl (2.4 MB)
         ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.4/2.4 MB 78.2 MB/s eta 0:00:00
    Collecting cffi>=1.12
      Downloading cffi-1.15.1-cp311-cp311-win_amd64.whl (179 kB)
         ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 179.0/179.0 kB ? eta 0:00:00
    Collecting ppft>=1.7.6.6
      Downloading ppft-1.7.6.6-py3-none-any.whl (52 kB)
         ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 52.8/52.8 kB ? eta 0:00:00
    Collecting dill>=0.3.6
      Downloading dill-0.3.6-py3-none-any.whl (110 kB)
         ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 110.5/110.5 kB ? eta 0:00:00
    Collecting pox>=0.3.2
      Downloading pox-0.3.2-py3-none-any.whl (29 kB)
    Collecting multiprocess>=0.70.14
      Downloading multiprocess-0.70.14-py310-none-any.whl (134 kB)
         ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 134.3/134.3 kB ? eta 0:00:00
    Collecting six>=1.10.0
      Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
    Collecting charset-normalizer<3,>=2
      Downloading charset_normalizer-2.1.1-py3-none-any.whl (39 kB)
    Collecting idna<4,>=2.5
      Downloading idna-3.4-py3-none-any.whl (61 kB)
         ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.5/61.5 kB ? eta 0:00:00
    Collecting urllib3<1.27,>=1.21.1
      Downloading urllib3-1.26.12-py2.py3-none-any.whl (140 kB)
         ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 140.4/140.4 kB ? eta 0:00:00
    Collecting certifi>=2017.4.17
      Downloading certifi-2022.9.24-py3-none-any.whl (161 kB)
         ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 161.1/161.1 kB ? eta 0:00:00
    Collecting pycparser
      Downloading pycparser-2.21-py2.py3-none-any.whl (118 kB)
         ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.7/118.7 kB ? eta 0:00:00
    Installing collected packages: urllib3, six, pycparser, ppft, pox, lxml, idna, dill, charset-normalizer, certifi, requests, PyExecJS, multiprocess, cffi, pathos, cryptography, translators
      DEPRECATION: lxml is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
      Running setup.py install for lxml ... error
      error: subprocess-exited-with-error
    
      × Running setup.py install for lxml did not run successfully.
      │ exit code: 1
      ╰─> [76 lines of output]
          Building lxml version 4.9.1.
          Building without Cython.
          Building against pre-built libxml2 andl libxslt libraries
          running install
          C:\Users\preri\Desktop\test\Lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
            warnings.warn(
          running build
          running build_py
          creating build
          creating build\lib.win-amd64-cpython-311
          creating build\lib.win-amd64-cpython-311\lxml
          copying src\lxml\builder.py -> build\lib.win-amd64-cpython-311\lxml
          copying src\lxml\cssselect.py -> build\lib.win-amd64-cpython-311\lxml
          copying src\lxml\doctestcompare.py -> build\lib.win-amd64-cpython-311\lxml
          copying src\lxml\ElementInclude.py -> build\lib.win-amd64-cpython-311\lxml
          copying src\lxml\pyclasslookup.py -> build\lib.win-amd64-cpython-311\lxml
          copying src\lxml\sax.py -> build\lib.win-amd64-cpython-311\lxml
          copying src\lxml\usedoctest.py -> build\lib.win-amd64-cpython-311\lxml
          copying src\lxml\_elementpath.py -> build\lib.win-amd64-cpython-311\lxml
          copying src\lxml\__init__.py -> build\lib.win-amd64-cpython-311\lxml
          creating build\lib.win-amd64-cpython-311\lxml\includes
          copying src\lxml\includes\__init__.py -> build\lib.win-amd64-cpython-311\lxml\includes
          creating build\lib.win-amd64-cpython-311\lxml\html
          copying src\lxml\html\builder.py -> build\lib.win-amd64-cpython-311\lxml\html
          copying src\lxml\html\clean.py -> build\lib.win-amd64-cpython-311\lxml\html
          copying src\lxml\html\defs.py -> build\lib.win-amd64-cpython-311\lxml\html
          copying src\lxml\html\diff.py -> build\lib.win-amd64-cpython-311\lxml\html
          copying src\lxml\html\ElementSoup.py -> build\lib.win-amd64-cpython-311\lxml\html
          copying src\lxml\html\formfill.py -> build\lib.win-amd64-cpython-311\lxml\html
          copying src\lxml\html\html5parser.py -> build\lib.win-amd64-cpython-311\lxml\html
          copying src\lxml\html\soupparser.py -> build\lib.win-amd64-cpython-311\lxml\html
          copying src\lxml\html\usedoctest.py -> build\lib.win-amd64-cpython-311\lxml\html
          copying src\lxml\html\_diffcommand.py -> build\lib.win-amd64-cpython-311\lxml\html
          copying src\lxml\html\_html5builder.py -> build\lib.win-amd64-cpython-311\lxml\html
          copying src\lxml\html\_setmixin.py -> build\lib.win-amd64-cpython-311\lxml\html
          copying src\lxml\html\__init__.py -> build\lib.win-amd64-cpython-311\lxml\html
          creating build\lib.win-amd64-cpython-311\lxml\isoschematron
          copying src\lxml\isoschematron\__init__.py -> build\lib.win-amd64-cpython-311\lxml\isoschematron
          copying src\lxml\etree.h -> build\lib.win-amd64-cpython-311\lxml
          copying src\lxml\etree_api.h -> build\lib.win-amd64-cpython-311\lxml
          copying src\lxml\lxml.etree.h -> build\lib.win-amd64-cpython-311\lxml
          copying src\lxml\lxml.etree_api.h -> build\lib.win-amd64-cpython-311\lxml
          copying src\lxml\includes\c14n.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
          copying src\lxml\includes\config.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
          copying src\lxml\includes\dtdvalid.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
          copying src\lxml\includes\etreepublic.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
          copying src\lxml\includes\htmlparser.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
          copying src\lxml\includes\relaxng.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
          copying src\lxml\includes\schematron.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
          copying src\lxml\includes\tree.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
          copying src\lxml\includes\uri.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
          copying src\lxml\includes\xinclude.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
          copying src\lxml\includes\xmlerror.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
          copying src\lxml\includes\xmlparser.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
          copying src\lxml\includes\xmlschema.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
          copying src\lxml\includes\xpath.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
          copying src\lxml\includes\xslt.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
          copying src\lxml\includes\__init__.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
          copying src\lxml\includes\etree_defs.h -> build\lib.win-amd64-cpython-311\lxml\includes
          copying src\lxml\includes\lxml-version.h -> build\lib.win-amd64-cpython-311\lxml\includes
          creating build\lib.win-amd64-cpython-311\lxml\isoschematron\resources
          creating build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\rng
          copying src\lxml\isoschematron\resources\rng\iso-schematron.rng -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\rng
          creating build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl
          copying src\lxml\isoschematron\resources\xsl\RNG2Schtrn.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl
          copying src\lxml\isoschematron\resources\xsl\XSD2Schtrn.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl
          creating build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
          copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_abstract_expand.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
          copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_dsdl_include.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
          copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_message.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
          copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_skeleton_for_xslt1.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
          copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_svrl_for_xslt1.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
          copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\readme.txt -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
          running build_ext
          building 'lxml.etree' extension
          error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
          [end of output]
    
      note: This error originates from a subprocess, and is likely not a problem with pip.
    error: legacy-install-failure
    
    × Encountered error while trying to install package.
    ╰─> lxml
    
    note: This is an issue with the package mentioned above, not pip.
    hint: See above for output from the failure.
    
    need other help good question solved runtime environment limited 
    opened by preritdas 8
  • The number of responses differs for each execution.

    The number of responses differs for each execution.

    Hello! It's a nice library. I'm letting you use it.

    I have a question.

    I'm threading API requests for this library, There's going to be problems.

    In the local environment, the number of responses returned and the time it takes vary greatly each time, and even if there are few responses, about 200 are not enough every time.

    But when I run it on EC2, the request and response numbers are perfect every time. The time is about 1/3 compared to local.

    I want to clarify what makes this difference. I know you're busy, but I want you to tell me.

    solved 
    opened by syuya-tanaka 7
  • Issue with Baidu API

    Issue with Baidu API

    I try to use translators Baidu API, but this code resulted in an error.

    r = ts.baidu("book", to_language="zh", sleep_seconds=0)
    print(r)
    
        def get_sign(self, query_text, host_html, ss, timeout, proxies):
    >       gtk = re.compile("window.gtk = '(.*?)';").findall(host_html)[0]
    E       IndexError: list index out of range
    

    I check the host_html it returned. It seems Baidu change the single quotation marks to double quotation marks, which causes this problem.

        <script>
        // token为空表示第一次访问百度网站服务器端没有收到baiduid cookie,会导致翻译接口校验不通过,通过刷新解决
                        if (!window.common.token) {
                    location.reload();
                }
                window.bdstoken = "";window.gtk = "320305.131321201";
                </script>
        </body>
    </html>
    

    Change the regex to window\.gtk = [\"'](.*?)[\"']; works fine. You can change it by yourself. Or I can make a pull request if you need.

    solved bug after translation server changes 
    opened by Seraphli 7
  • Is there a way to get a list of languages for a given service?

    Is there a way to get a list of languages for a given service?

    @UlionTse Is there a way to get a list of languages for a given service? For example, I want to get the list of languages for Google. Can I just do this:

    print(ts.google.languages)
    >>> {"en": "English"...}
    
    need other help good question add function solved 
    opened by Infiniticity 7
  • tencent不能用啦

    tencent不能用啦

    Traceback (most recent call last): File "D:/python/trans/UlionTse_translators.py", line 15, in print(ts.tencent(x)) File "D:\windows\soft\anaconda3\lib\site-packages\translators\apis.py", line 65, in wrapper r = func(args, **kwargs) File "D:\windows\soft\anaconda3\lib\site-packages\translators\apis.py", line 493, in tencent_api qtv = re.findall('var qtv = "(.?)"', host_html)[0] IndexError: list index out of range

    bug solved code robustness bug after translation server changes 
    opened by prigioni 7
  • Google translate is not working

    Google translate is not working

    Hello,

    I have a problem with Google translate:

    >>> import translators
    Using Russia server backend.
    >>> translators.google('Привет', from_language='ru', to_language='en')
    
    

    After debugging I think the problem is here https://github.com/UlionTse/translators/blob/master/translators/apis.py#L217

    Can you check please?

    solved bug after translation server changes 
    opened by bredpittt 7
  • [Feature]:  Better Introduction

    [Feature]: Better Introduction

    Expect to happened

    A feature I have expected ... I am a bit confused. There is no high level description. You mention all of these different translation services.

    I will get this wrong, but you need to say something like.

    This translators api uses a Node server to pretend to be an end user seeking translation services. You can choose which free translation service you want to use. First you have to check if that translation service translates the languages you want to translate in the country where you live. You are also likely to get rate limited. Sadly we do not know when those limits kick in, nor does the api rate limit you, you have to do that yourself.

    Nor does the api round robin the translation services, to prevent rate limiting.

    Anyhow some such high level description of how this software works would be most helpful.

    Expected APP Version

    a future version

    Expected Python Version

    3.9

    Expected Runtime Environment

    Other

    Country/Region

    Poland

    Expected Output

    Just a better introduction.
    

    Code of Conduct

    • [X] I agree to follow this project's Code of Conduct
    opened by PythonLinks 0
  • Yandex 403

    Yandex 403

    Yandex translate doesn't work at all (google for example is fine)

    Code: import translators print(translators.yandex("Привет"))

    Output: Using state Moscow server backend. Traceback (most recent call last): File "D:\Code\pythonProject\main.py", line 2, in print(translators.yandex("Привет")) File "D:\Code\pythonProject\venv\lib\site-packages\translators\apis.py", line 1418, in yandex_api r.raise_for_status() File "D:\Code\pythonProject\venv\lib\site-packages\requests\models.py", line 1021, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://translate.yandex.com/

    bug after translation server changes 
    opened by re7gog 0
  • PyExecJS has been end-of-life since 2018

    PyExecJS has been end-of-life since 2018

    PyExecJS is no longer maintained and hasn't been updated since 2018, since the main reason for that package was to deal with Node not being available for Windows, which is no longer an issue. They recommend to just call Node through subprocess directly, passing in the code you want to execute with stdin.

    I've had a look at the calls to execjs and the only one I think might be an issue is this one because of the use of .call(), however I think this can be replicated by creating the function call in JS and appending it to the code that is currently passed into .compile().

    If you would like, I'd be happy to look into this further and open a PR.

    lack of information good idea 
    opened by freddyheppell 3
sangha, pronounced "suhng-guh", is a social networking, booking platform where students and teachers can share their practice.

Flask React Project This is the backend for the Flask React project. Getting started Clone this repository (only this branch) git clone https://github

Courtney Newcomer 17 Sep 29, 2021
Open-source offline translation library written in Python. Uses OpenNMT for translations

Open source neural machine translation in Python. Designed to be used either as a Python library or desktop application. Uses OpenNMT for translations and PyQt for GUI.

Argos Open Tech 1.6k Jan 1, 2023
A deep learning-based translation library built on Huggingface transformers

DL Translate A deep learning-based translation library built on Huggingface transformers and Facebook's mBART-Large ?? GitHub Repository ?? Documentat

Xing Han Lu 244 Dec 30, 2022
Which Apple Keeps Which Doctor Away? Colorful Word Representations with Visual Oracles

Which Apple Keeps Which Doctor Away? Colorful Word Representations with Visual Oracles (TASLP 2022)

Zhuosheng Zhang 3 Apr 14, 2022
Translation to python of Chris Sims' optimization function

pycsminwel This is a locol minimization algorithm. Uses a quasi-Newton method with BFGS update of the estimated inverse hessian. It is robust against

Gustavo Amarante 1 Mar 21, 2022
Simple, Pythonic, text processing--Sentiment analysis, part-of-speech tagging, noun phrase extraction, translation, and more.

TextBlob: Simplified Text Processing Homepage: https://textblob.readthedocs.io/ TextBlob is a Python (2 and 3) library for processing textual data. It

Steven Loria 8.4k Dec 26, 2022
Summarization, translation, sentiment-analysis, text-generation and more at blazing speed using a T5 version implemented in ONNX.

Summarization, translation, Q&A, text generation and more at blazing speed using a T5 version implemented in ONNX. This package is still in alpha stag

Abel 211 Dec 28, 2022
Simple, Pythonic, text processing--Sentiment analysis, part-of-speech tagging, noun phrase extraction, translation, and more.

TextBlob: Simplified Text Processing Homepage: https://textblob.readthedocs.io/ TextBlob is a Python (2 and 3) library for processing textual data. It

Steven Loria 7.5k Feb 17, 2021
Summarization, translation, sentiment-analysis, text-generation and more at blazing speed using a T5 version implemented in ONNX.

Summarization, translation, Q&A, text generation and more at blazing speed using a T5 version implemented in ONNX. This package is still in alpha stag

Abel 137 Feb 1, 2021
Universal End2End Training Platform, including pre-training, classification tasks, machine translation, and etc.

背景 安装教程 快速上手 (一)预训练模型 (二)机器翻译 (三)文本分类 TenTrans 进阶 1. 多语言机器翻译 2. 跨语言预训练 背景 TrenTrans是一个统一的端到端的多语言多任务预训练平台,支持多种预训练方式,以及序列生成和自然语言理解任务。 安装教程 git clone git

Tencent Minority-Mandarin Translation Team 42 Dec 20, 2022
A script that automatically creates a branch name using google translation api and jira api

About google translation api와 jira api을 사용하여 자동으로 브랜치 이름을 만들어주는 스크립트 Setup 환경변수에 다음 3가지를 등록해야 한다. JIRA_USER : JIRA email (ex: [email protected]) JIR

hyunwook.kim 2 Dec 20, 2021
The model is designed to train a single and large neural network in order to predict correct translation by reading the given sentence.

Neural Machine Translation communication system The model is basically direct to convert one source language to another targeted language using encode

Nishant Banjade 7 Sep 22, 2022
null 1 Jun 28, 2022
Implementaion of our ACL 2022 paper Bridging the Data Gap between Training and Inference for Unsupervised Neural Machine Translation

Bridging the Data Gap between Training and Inference for Unsupervised Neural Machine Translation This is the implementaion of our paper: Bridging the

hezw.tkcw 20 Dec 12, 2022
Implementation of the Hybrid Perception Block and Dual-Pruned Self-Attention block from the ITTR paper for Image to Image Translation using Transformers

ITTR - Pytorch Implementation of the Hybrid Perception Block (HPB) and Dual-Pruned Self-Attention (DPSA) block from the ITTR paper for Image to Image

Phil Wang 17 Dec 23, 2022
Associated Repository for "Translation between Molecules and Natural Language"

MolT5: Translation between Molecules and Natural Language Associated repository for "Translation between Molecules and Natural Language". Table of Con

null 67 Dec 15, 2022
Easy to use, state-of-the-art Neural Machine Translation for 100+ languages

EasyNMT - Easy to use, state-of-the-art Neural Machine Translation This package provides easy to use, state-of-the-art machine translation for more th

Ubiquitous Knowledge Processing Lab 748 Jan 6, 2023
Open Source Neural Machine Translation in PyTorch

OpenNMT-py: Open-Source Neural Machine Translation OpenNMT-py is the PyTorch version of the OpenNMT project, an open-source (MIT) neural machine trans

OpenNMT 5.8k Jan 4, 2023