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.0.tar.gz
(5.3 kB
view hashes)
Built Distribution
Close
Hashes for translatedoc-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ddee35279fbe25a890ab0f229ddcfbfbf814f531784201116ed280ba005c6cb7 |
|
MD5 | d4b4f5d8ad78936a51ba40ff6879a492 |
|
BLAKE2b-256 | c7ab7cf60fdf23b3768743b697e7d792463aeb517214fe1cb10e4263ffa81cfd |