天真的逐字翻译
naive-translator的Python项目详细描述
天真的翻译
一个基于词到词词典的非常简单的翻译器
(尽管这个项目是为了改变传统的 简而言之,它拥有做更多事情的能力。
一。如何使用
1.1安装
pip3 install naive_translator
1.2作为包装使用
>>> from naive_translator import translator >>> translation = translator('豐田的上門女婿和女人') >>> print(translation) 丰田的上门女婿和女人
1.3用作服务器
要启动服务器,请运行以下命令
naive_translator 8001
然后您可以访问
Url | Explanation |
---|---|
http://localhost:8001 | A welcome page |
http://localhost:8001/dicts | List all available dictionaries |
http://localhost:8001/translate?dict=&text= | Translate |
其他
- 字典文件放在
naive_translator/data
目录中 - 配置文件是
naive_translator/config.py