Skip to content

Copy Japanese sentences and automatically generate translations or vocabulary lists using AI

License

Notifications You must be signed in to change notification settings

alac/clipboard_translate

Repository files navigation

clipboard_translate

Copy Japanese sentences and automatically generate translations or vocabulary lists using AI. Useful with a text hooking utility like Textractor.

"Recording of the live translation behavior"
Live translations, vocabulary lists.

"Recording of the ai questioning behavior"
Ask questions, with the previous lines as context. Uses ctrl+enter as a shortcut.

Additional features:

  • Keeps a history of previous lines, so that translations can be more accurate.
  • Allows for supplying a 'context' for a description of what you're translating (e.g. "These are twitter posts", or a list of characters in a story).

Setup

  1. Install with pip install -r requirements.txt and python -m unidic download.
  2. Edit settings.toml to enable what you want.
  3. For AI behaviors, you can either set a Google Gemini API key in the settings file.
    Or, install Oobabooga's Text-Generation-WebUI, enable the API and configure it in the settings file.
  4. Start the app by entering python -m jp_vocab_monitor_ui [story_name].

Configuration

You can also configure the program by creating a user.toml in the root directory. Then, settings will be loaded from settings.toml first, with any overlapping values overridden by user.toml.

Per story configuration is also possible by adding a [story_name].toml in the settings folder.
In particular, you can add synopsis to guide the AI with the ai_translation_context key.

Suggested Models

I've seen decent translation quality with the following local models:

If you're going to ask the AI questions about Japanese, I'd recommend using Google's Gemini Pro via API (Gemini 1.5's accuracy is great; and the free-tier rate limiting should be fine for reading).

Credits

For definitions and katakana readings in non-ML mode, we use a modified Jitendex, which is under the ShareAlike license.

For breaking sentences into words, we use fugashi.

About

Copy Japanese sentences and automatically generate translations or vocabulary lists using AI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages