Files
VRCT/src-python/docs/modules/translation.md
misyaguziya 5efa9c37d6 Add documentation for modules and runtime instructions
- Created detailed documentation for the device_manager, model, model_extra, osc, overlay, overlay_image, transcription, translation, transliteration, utils, watchdog, and websocket modules.
- Added a comprehensive run events payloads document outlining the payloads sent during various run events in the controller.
- Included runtime instructions and dependencies for setting up the project in a Windows environment.
- Introduced a mypy configuration file to manage type checking and ignore errors in specific modules temporarily.
2025-10-09 13:11:59 +09:00

1.1 KiB
Raw Blame History

models/translation — 詳細設計

構成ファイル:

  • translation_translator.py — Translator クラス。DeepL/API、Google、Bing、Papago、CTranslate2 を統一インターフェースで扱う。
  • translation_utils.py — 重みファイルのダウンロード・検証ロジックCTranslate2 用)。
  • translation_languages.py — 各エンジンの対応言語マップ。

Translator の契約:

  • translate(translator_name, source_language, target_language, target_country, message) -> str|False
    • 成功時は文字列、失敗または一時的エラーは False を返す。
  • changeCTranslate2Model(path, model_type, device, device_index, compute_type)
    • CTranslate2 の Translator オブジェクトと Tokenizer を初期化する。

フォールバック:

  • Controller/Model 層で翻訳が失敗した場合に CTranslate2 にフォールバックする実装がある。

外部依存:

  • ctranslate2, transformers, deeplオプション、translators任意

安全性:

  • 翻訳 API キーDeepLは Translator.authenticationDeepLAuthKey で検証して保持。