Skip to main content

机翻引擎

Project description

快速上手

# 导入翻译类
from mt_engines import MTTranslator
# 初始化翻译引擎
'''
translator = MTTranslator('Google')
translator = MTTranslator('Deepl', key='***')
translator = MTTranslator('Tencent', id='***', key='***', region='***')
'''
translator = MTTranslator('Google')
# 查看翻译引擎支持的语种名称
translator.support_languages
# 单个文本翻译
result = translator.translate('待翻文本','zh-CN','en')
# 多个待翻译文本
result = translator.pool_translate(['待翻文本1','待翻文本2','待翻文本3'],'zh-CN','en')
# 导入待翻译文件
translator.load_file('翻译表.xlsx')
# 翻译加载的文件,第3个参数为元组,输入待翻译文件的起始行,终止行,原文列,译文列
translator.translate_file('zh-CN','en',(1,'auto',1,2))
# 启用均衡算法进行批量机翻
result = translator.compress_translate(    ['待翻文本1','待翻文本2','待翻文本3'],    'zh-CN',    'en',     thread_num=3,     max_words=2000)
# 在文件翻译中启用均衡算法
result = translator.translate_file('zh-CN','en',(1,'auto',1,2),compress=True)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mt_engines-2.0.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file mt_engines-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: mt_engines-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for mt_engines-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a0dbccf6e5148f2b8344adc8d0e8556fc309b7fd8949cf97f7998dfeae02a2d3
MD5 776b816a1e5534e0c581f175b71fbff9
BLAKE2b-256 8a68e531c6329bd55cf44cc6a112844bdb8135cd9773231b23d59b5e0a1e9a55

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page