Python Formatters, Linters, and Testers Runner.
Project description
translatedoc
PDFなどのドキュメントを翻訳するツール。
Unstructuredで読み込み、OpenAI APIに渡しているだけ。
インストール
1. Unstructured
インストール例:
sudo apt install poppler-utils poppler-data tesseract-ocr tesseract-ocr-jpn
pip install unstructured[all-docs] --extra-index-url https://download.pytorch.org/whl/cu118
cu118
のところは環境に合わせて変更する。
詳細はUnstructuredのドキュメントを参照。
2. translatedoc
pip install translatedoc
使い方
export OPENAI_API_KEY=<your_api_key>
translatedoc --language=Japanese <input_files_and_or_urls>
カレントディレクトリにファイル名.Source.txt
とファイル名.Japanese.txt
が生成される。
詳細は translatedoc --help
を参照。
環境変数
環境変数名 | 概要 | デフォルト値 |
---|---|---|
OPENAI_API_BASE |
OpenAI APIのベースURL | https://api.openai.com/v1 |
OPENAI_API_KEY |
OpenAI APIのキー | - |
TRANSLATEDOC_MODEL |
翻訳に使用するモデル | gpt-3.5-turbo-1106 |
TRANSLATEDOC_STRATEGY |
ドキュメントのパーティション化に使用する戦略 | hi_res |
TRANSLATEDOC_CHUNK_MAX_CHARS |
パーティション化の際の最大文字数 | 2000 |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
translatedoc-1.1.1.tar.gz
(5.3 kB
view hashes)
Built Distribution
Close
Hashes for translatedoc-1.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d24de7dc28a7ae4b936f9a123cf675e9b558f170c489d1235109c69ecf3d76b |
|
MD5 | ee4539b92b80eafb2f2fc8eef230aea5 |
|
BLAKE2b-256 | ada1f83947ed498fa161282fc1983234196141ea47f6cce6bc77b0e10ddef9fb |