Skip to content

设计一个本地安装的Python GUI应用,用于将中文翻译成英文或印尼文,并支持PDF、Excel和Word三种格式的翻译。应用首先优先使用本地向量数据库,如果有类似的翻译任务,则直接从数据库中获取翻译结果。当本地向量数据库中无法命中时,再进行远程调用谷歌或OpenAI的API,并将结果保存在本地供后续使用。同时,在本地向量数据库中增加一个关键字表,用于处理行业内和公司内部的关键词翻译。

License

Notifications You must be signed in to change notification settings

AdamKittyBst/translateTPII

Repository files navigation

TranslateTPII

Develop a local Python GUI application that translates Chinese text to English or Indonesian, prioritizing local vector database and using remote Google or OpenAI API as backup, with results saved locally for future use.

Built with Cookiecutter Django Black code style

Settings

Moved to settings.

Basic Commands

Setting Up Your Users

  • To create a normal user account, just go to Sign Up and fill out the form. Once you submit it, you'll see a "Verify Your E-mail Address" page. Go to your console to see a simulated email verification message. Copy the link into your browser. Now the user's email should be verified and ready to go.

  • To create a superuser account, use this command:

    $ python manage.py createsuperuser
    

For convenience, you can keep your normal user logged in on Chrome and your superuser logged in on Firefox (or similar), so that you can see how the site behaves for both kinds of users.

Type checks

Running type checks with mypy:

$ mypy trans

Test coverage

To run the tests, check your test coverage, and generate an HTML coverage report:

$ coverage run -m pytest
$ coverage html
$ open htmlcov/index.html

Running tests with pytest

$ pytest

Live reloading and Sass CSS compilation

Moved to Live reloading and SASS compilation.

Deployment

The following details how to deploy this application.

文件结构

  • main.py: 主应用程序入口,负责启动整个应用。
  • gui/: 存放与用户界面相关的代码。
    • app.py: Tkinter GUI的主要实现代码。
    • widgets.py: 自定义的Tkinter小部件(widgets)代码。
  • assets/: 存放应用需要使用的图片、图标等资源文件。
  • translation/: 存放与翻译相关的代码。
    • translator.py: 负责调用翻译API,处理翻译任务的代码。
    • history.py: 管理历史翻译记录的代码。
    • keyword_table.py: 管理关键字表的代码。
  • local_db/: 存放本地向量数据库相关的代码。
    • db_operations.py: 对本地向量数据库的增删改查操作。
  • files/: 存放用户选择的文件和翻译后的文件。
  • translated_files/: 存放翻译后的文件。
  • requirements.txt: 用于记录项目所需的依赖库及其版本。

About

设计一个本地安装的Python GUI应用,用于将中文翻译成英文或印尼文,并支持PDF、Excel和Word三种格式的翻译。应用首先优先使用本地向量数据库,如果有类似的翻译任务,则直接从数据库中获取翻译结果。当本地向量数据库中无法命中时,再进行远程调用谷歌或OpenAI的API,并将结果保存在本地供后续使用。同时,在本地向量数据库中增加一个关键字表,用于处理行业内和公司内部的关键词翻译。

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published