增加赞赏渠道
This commit is contained in:
107
README.md
107
README.md
@@ -20,18 +20,26 @@
|
||||
A lightweight local file translation tool based on a large language model.
|
||||
</p>
|
||||
|
||||
- ✅ **Supports Multiple Formats**: Can translate various files such as `pdf`, `docx`, `xlsx`, `md`, `txt`, `json`, `epub`, `srt`, and more.
|
||||
- ✅ **Supports Multiple Formats**: Can translate various files such as `pdf`, `docx`, `xlsx`, `md`, `txt`, `json`,
|
||||
`epub`, `srt`, and more.
|
||||
- ✅ **Automatic Glossary Generation**: Supports automatic generation of glossaries to ensure term alignment.
|
||||
- ✅ **PDF Table, Formula, and Code Recognition**: With the `docling` and `mineru` PDF parsing engines, it can recognize and translate tables, formulas, and code frequently found in academic papers.
|
||||
- ✅ **JSON Translation**: Supports specifying the values to be translated in JSON via JSON paths (using `jsonpath-ng` syntax).
|
||||
- ✅ **Word/Excel Format-Preserving Translation**: Supports translating `docx` and `xlsx` files (currently not `doc` or `xls` files) while preserving the original formatting.
|
||||
- ✅ **Multi-AI Platform Support**: Supports most AI platforms, enabling high-performance, concurrent AI translation with custom prompts.
|
||||
- ✅ **Asynchronous Support**: Designed for high-performance scenarios, it offers complete asynchronous support, providing service interfaces for parallel multitasking.
|
||||
- ✅ **PDF Table, Formula, and Code Recognition**: With the `docling` and `mineru` PDF parsing engines, it can recognize
|
||||
and translate tables, formulas, and code frequently found in academic papers.
|
||||
- ✅ **JSON Translation**: Supports specifying the values to be translated in JSON via JSON paths (using `jsonpath-ng`
|
||||
syntax).
|
||||
- ✅ **Word/Excel Format-Preserving Translation**: Supports translating `docx` and `xlsx` files (currently not `doc` or
|
||||
`xls` files) while preserving the original formatting.
|
||||
- ✅ **Multi-AI Platform Support**: Supports most AI platforms, enabling high-performance, concurrent AI translation with
|
||||
custom prompts.
|
||||
- ✅ **Asynchronous Support**: Designed for high-performance scenarios, it offers complete asynchronous support,
|
||||
providing service interfaces for parallel multitasking.
|
||||
- ✅ **LAN and Multi-user Support**: Supports simultaneous use by multiple users on a local area network.
|
||||
- ✅ **Interactive Web Interface**: Provides an out-of-the-box Web UI and RESTful API for easy integration and use.
|
||||
- ✅ **Small-Footprint, Multi-Platform "Lazy" Packages**: Windows and Mac "lazy" packages under 40MB (for versions not using `docling` for local PDF parsing).
|
||||
- ✅ **Small-Footprint, Multi-Platform "Lazy" Packages**: Windows and Mac "lazy" packages under 40MB (for versions not
|
||||
using `docling` for local PDF parsing).
|
||||
|
||||
> When translating `pdf` files, they are first converted to Markdown, which will **lose** the original layout. Users with layout requirements should take note.
|
||||
> When translating `pdf` files, they are first converted to Markdown, which will **lose** the original layout. Users
|
||||
> with layout requirements should take note.
|
||||
|
||||
> QQ Discussion Group: 1047781902
|
||||
|
||||
@@ -45,10 +53,14 @@
|
||||
|
||||
## All-in-One Packages
|
||||
|
||||
For users who want to get started quickly, we provide all-in-one packages on [GitHub Releases](https://github.com/xunbu/docutranslate/releases). Simply download, unzip, and enter your AI platform API-Key to start using.
|
||||
For users who want to get started quickly, we provide all-in-one packages
|
||||
on [GitHub Releases](https://github.com/xunbu/docutranslate/releases). Simply download, unzip, and enter your AI
|
||||
platform API-Key to start using.
|
||||
|
||||
- **DocuTranslate**: Standard version, uses the online `minerU` engine to parse PDF documents. Choose this version if you don't need local PDF parsing (recommended).
|
||||
- **DocuTranslate_full**: Full version, includes the built-in `docling` local PDF parsing engine. Choose this version if you need local PDF parsing.
|
||||
- **DocuTranslate**: Standard version, uses the online `minerU` engine to parse PDF documents. Choose this version if
|
||||
you don't need local PDF parsing (recommended).
|
||||
- **DocuTranslate_full**: Full version, includes the built-in `docling` local PDF parsing engine. Choose this version if
|
||||
you need local PDF parsing.
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -88,23 +100,28 @@ uv sync
|
||||
|
||||
## Core Concept: Workflow
|
||||
|
||||
The core of the new DocuTranslate is the **Workflow**. Each workflow is a complete, end-to-end translation pipeline designed specifically for a particular file type. You no longer interact with a monolithic class; instead, you select and configure a suitable workflow based on your file type.
|
||||
The core of the new DocuTranslate is the **Workflow**. Each workflow is a complete, end-to-end translation pipeline
|
||||
designed specifically for a particular file type. You no longer interact with a monolithic class; instead, you select
|
||||
and configure a suitable workflow based on your file type.
|
||||
|
||||
**The basic usage process is as follows:**
|
||||
|
||||
1. **Select a Workflow**: Choose a workflow based on your input file type (e.g., PDF/Word or TXT), such as `MarkdownBasedWorkflow` or `TXTWorkflow`.
|
||||
2. **Build the Configuration**: Create the corresponding configuration object for the selected workflow (e.g., `MarkdownBasedWorkflowConfig`). This configuration object contains all the necessary sub-configurations, such as:
|
||||
1. **Select a Workflow**: Choose a workflow based on your input file type (e.g., PDF/Word or TXT), such as
|
||||
`MarkdownBasedWorkflow` or `TXTWorkflow`.
|
||||
2. **Build the Configuration**: Create the corresponding configuration object for the selected workflow (e.g.,
|
||||
`MarkdownBasedWorkflowConfig`). This configuration object contains all the necessary sub-configurations, such as:
|
||||
* **Converter Config**: Defines how to convert the original file (e.g., PDF) to Markdown.
|
||||
* **Translator Config**: Defines which LLM, API-Key, target language, etc., to use.
|
||||
* **Exporter Config**: Defines specific options for the output format (e.g., HTML).
|
||||
3. **Instantiate the Workflow**: Create a workflow instance using the configuration object.
|
||||
4. **Execute the Translation**: Call the workflow's `.read_*()` and `.translate()` / `.translate_async()` methods.
|
||||
5. **Export/Save the Result**: Call the `.export_to_*()` or `.save_as_*()` methods to get or save the translation result.
|
||||
5. **Export/Save the Result**: Call the `.export_to_*()` or `.save_as_*()` methods to get or save the translation
|
||||
result.
|
||||
|
||||
## Available Workflows
|
||||
|
||||
| Workflow | Use Case | Input Formats | Output Formats | Core Config Class |
|
||||
|:---|:---|:---|:---|:---|
|
||||
|:----------------------------|:----------------------------------------------------------------------------------------------------------------------|:---------------------------------------------|:-----------------------|:------------------------------|
|
||||
| **`MarkdownBasedWorkflow`** | Processes rich text documents like PDF, Word, images, etc. The process is: `File -> Markdown -> Translate -> Export`. | `.pdf`, `.docx`, `.md`, `.png`, `.jpg`, etc. | `.md`, `.zip`, `.html` | `MarkdownBasedWorkflowConfig` |
|
||||
| **`TXTWorkflow`** | Processes plain text documents. The process is: `txt -> Translate -> Export`. | `.txt` and other plain text formats | `.txt`, `.html` | `TXTWorkflowConfig` |
|
||||
| **`JsonWorkflow`** | Processes JSON files. The process is: `json -> Translate -> Export`. | `.json` | `.json`, `.html` | `JsonWorkflowConfig` |
|
||||
@@ -134,14 +151,16 @@ export DOCUTRANSLATE_PORT=8011
|
||||
docutranslate -i
|
||||
```
|
||||
|
||||
- **Interactive Interface**: After starting the service, please visit `http://127.0.0.1:8010` (or your specified port) in your browser.
|
||||
- **Interactive Interface**: After starting the service, please visit `http://127.0.0.1:8010` (or your specified port)
|
||||
in your browser.
|
||||
- **API Documentation**: The complete API documentation (Swagger UI) is available at `http://127.0.0.1:8010/docs`.
|
||||
|
||||
## Usage
|
||||
|
||||
### Example 1: Translating a PDF File (using `MarkdownBasedWorkflow`)
|
||||
|
||||
This is the most common use case. We will use the `minerU` engine to convert the PDF to Markdown, and then use an LLM for translation. Here is an example using the asynchronous approach.
|
||||
This is the most common use case. We will use the `minerU` engine to convert the PDF to Markdown, and then use an LLM
|
||||
for translation. Here is an example using the asynchronous approach.
|
||||
|
||||
```python
|
||||
import asyncio
|
||||
@@ -207,7 +226,8 @@ if __name__ == "__main__":
|
||||
|
||||
### Example 2: Translating a TXT File (using `TXTWorkflow`)
|
||||
|
||||
For plain text files, the process is simpler as it doesn't require a document parsing (conversion) step. Here is an example using the asynchronous approach.
|
||||
For plain text files, the process is simpler as it doesn't require a document parsing (conversion) step. Here is an
|
||||
example using the asynchronous approach.
|
||||
|
||||
```python
|
||||
import asyncio
|
||||
@@ -254,7 +274,9 @@ if __name__ == "__main__":
|
||||
|
||||
### Example 3: Translating a JSON File (using `JsonWorkflow`)
|
||||
|
||||
Here is an example using the asynchronous approach. The `json_paths` item in `JsonTranslatorConfig` needs to specify the JSON paths to be translated (satisfying the `jsonpath-ng` syntax). Only values matching the JSON paths will be translated.
|
||||
Here is an example using the asynchronous approach. The `json_paths` item in `JsonTranslatorConfig` needs to specify the
|
||||
JSON paths to be translated (satisfying the `jsonpath-ng` syntax). Only values matching the JSON paths will be
|
||||
translated.
|
||||
|
||||
```python
|
||||
import asyncio
|
||||
@@ -405,12 +427,14 @@ if __name__ == "__main__":
|
||||
|
||||
### 1. Get a Large Language Model API Key
|
||||
|
||||
The translation functionality relies on large language models. You need to obtain a `base_url`, `api_key`, and `model_id` from the respective AI platform.
|
||||
The translation functionality relies on large language models. You need to obtain a `base_url`, `api_key`, and
|
||||
`model_id` from the respective AI platform.
|
||||
|
||||
> Recommended models: Volcengine's `doubao-seed-1-6-250615`, `doubao-seed-1-6-flash-250715`, Zhipu's `glm-4-flash`, Alibaba Cloud's `qwen-plus`, `qwen-turbo`, Deepseek's `deepseek-chat`, etc.
|
||||
> Recommended models: Volcengine's `doubao-seed-1-6-250615`, `doubao-seed-1-6-flash-250715`, Zhipu's `glm-4-flash`,
|
||||
> Alibaba Cloud's `qwen-plus`, `qwen-turbo`, Deepseek's `deepseek-chat`, etc.
|
||||
|
||||
| Platform Name | Get API Key | baseurl |
|
||||
|---|---|---|
|
||||
|-----------------------|-----------------------------------------------------------------------------------------------|----------------------------------------------------------|
|
||||
| ollama | | http://127.0.0.1:11434/v1 |
|
||||
| lm studio | | http://127.0.0.1:1234/v1 |
|
||||
| openrouter | [Click to get](https://openrouter.ai/settings/keys) | https://openrouter.ai/api/v1 |
|
||||
@@ -437,18 +461,23 @@ If you choose `mineru` as the document parsing engine (`convert_engine="mineru"`
|
||||
|
||||
### 2.2. docling Engine Configuration (local PDF parsing)
|
||||
|
||||
If you choose `docling` as the document parsing engine (`convert_engine="docling"`), it will download the required models from Hugging Face on first use.
|
||||
If you choose `docling` as the document parsing engine (`convert_engine="docling"`), it will download the required
|
||||
models from Hugging Face on first use.
|
||||
|
||||
> A better option is to download `docling_artifact.zip` from [GitHub releases](https://github.com/xunbu/docutranslate/releases) and unzip it to your working directory.
|
||||
> A better option is to download `docling_artifact.zip`
|
||||
> from [GitHub releases](https://github.com/xunbu/docutranslate/releases) and unzip it to your working directory.
|
||||
|
||||
**Solution for network issues when downloading `docling` models:**
|
||||
|
||||
1. **Set a Hugging Face mirror (recommended)**:
|
||||
* **Method A (environment variable)**: Set the system environment variable `HF_ENDPOINT` and restart your IDE or terminal.
|
||||
|
||||
* **Method A (environment variable)**: Set the system environment variable `HF_ENDPOINT` and restart your IDE or
|
||||
terminal.
|
||||
```
|
||||
HF_ENDPOINT=https://hf-mirror.com
|
||||
```
|
||||
* **Method B (set in code)**: Add the following code at the beginning of your Python script.
|
||||
|
||||
```python
|
||||
import os
|
||||
|
||||
@@ -456,9 +485,11 @@ os.environ['HF_ENDPOINT'] = 'https://hf-mirror.com'
|
||||
```
|
||||
|
||||
2. **Offline use (download the model package in advance)**:
|
||||
|
||||
* Download `docling_artifact.zip` from [GitHub Releases](https://github.com/xunbu/docutranslate/releases).
|
||||
* Unzip it to your project directory.
|
||||
* Specify the model path in the configuration (if the model is not in the same directory as the script):
|
||||
|
||||
```python
|
||||
from docutranslate.converter.x2md.converter_docling import ConverterDoclingConfig
|
||||
|
||||
@@ -478,19 +509,25 @@ A: Use the `-p` parameter to specify a new port, or set the `DOCUTRANSLATE_PORT`
|
||||
A: Yes. Please use the `mineru` parsing engine, which has powerful OCR capabilities.
|
||||
|
||||
**Q: Why is the first PDF translation so slow?**
|
||||
A: If you are using the `docling` engine, it needs to download models from Hugging Face on its first run. Please refer to the "Network Issues Solution" above to speed up this process.
|
||||
A: If you are using the `docling` engine, it needs to download models from Hugging Face on its first run. Please refer
|
||||
to the "Network Issues Solution" above to speed up this process.
|
||||
|
||||
**Q: How to use it in an intranet (offline) environment?**
|
||||
A: It is entirely possible. You need to meet the following conditions:
|
||||
|
||||
1. **Local LLM**: Use tools like [Ollama](https://ollama.com/) or [LM Studio](https://lmstudio.ai/) to deploy a language model locally, and fill in the `base_url` of the local model in `TranslatorConfig`.
|
||||
2. **Local PDF parsing engine** (only needed for parsing PDFs): Use the `docling` engine and follow the "Offline use" instructions above to download the model package in advance.
|
||||
1. **Local LLM**: Use tools like [Ollama](https://ollama.com/) or [LM Studio](https://lmstudio.ai/) to deploy a language
|
||||
model locally, and fill in the `base_url` of the local model in `TranslatorConfig`.
|
||||
2. **Local PDF parsing engine** (only needed for parsing PDFs): Use the `docling` engine and follow the "Offline use"
|
||||
instructions above to download the model package in advance.
|
||||
|
||||
**Q: How does the PDF parsing cache mechanism work?**
|
||||
A: `MarkdownBasedWorkflow` automatically caches the results of document parsing (file to Markdown conversion) to avoid repeated parsing that consumes time and resources. The cache is stored in memory by default and records the last 10 parses. You can modify the cache size using the `DOCUTRANSLATE_CACHE_NUM` environment variable.
|
||||
A: `MarkdownBasedWorkflow` automatically caches the results of document parsing (file to Markdown conversion) to avoid
|
||||
repeated parsing that consumes time and resources. The cache is stored in memory by default and records the last 10
|
||||
parses. You can modify the cache size using the `DOCUTRANSLATE_CACHE_NUM` environment variable.
|
||||
|
||||
**Q: How to make the software go through a proxy?**
|
||||
A: The software does not use a proxy by default. You can enable it by setting the environment variable `DOCUTRANSLATE_PROXY_ENABLED` to `true`.
|
||||
A: The software does not use a proxy by default. You can enable it by setting the environment variable
|
||||
`DOCUTRANSLATE_PROXY_ENABLED` to `true`.
|
||||
|
||||
## Star History
|
||||
|
||||
@@ -501,3 +538,11 @@ A: The software does not use a proxy by default. You can enable it by setting th
|
||||
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=xunbu/docutranslate&type=Date" />
|
||||
</picture>
|
||||
</a>
|
||||
|
||||
## Support the Author
|
||||
|
||||
Welcome to support the author. Please kindly mention the reason for your appreciation in the notes. ❤
|
||||
|
||||
<p align="center">
|
||||
<img src="./images/赞赏码.jpg" alt="赞赏码" style="width: 50vw">
|
||||
</p>
|
||||
49
README_JP.md
49
README_JP.md
@@ -24,12 +24,14 @@
|
||||
- ✅ **用語集の自動生成**:用語集を自動生成し、専門用語の統一を実現します。
|
||||
- ✅ **PDFの表、数式、コード認識**:`docling`、`mineru` PDF解析エンジンにより、学術論文によく見られる表、数式、コードを認識し、翻訳します。
|
||||
- ✅ **JSON翻訳**:JSON Path (`jsonpath-ng`構文仕様) を用いて、翻訳対象の値を指定できます。
|
||||
- ✅ **Word/Excelのフォーマットを維持した翻訳**:`docx`、`xlsx`ファイルの元のフォーマットを維持したまま翻訳をサポートします(現在`doc`、`xls`ファイルは未対応)。
|
||||
- ✅ **Word/Excelのフォーマットを維持した翻訳**:`docx`、`xlsx`ファイルの元のフォーマットを維持したまま翻訳をサポートします(現在
|
||||
`doc`、`xls`ファイルは未対応)。
|
||||
- ✅ **マルチAIプラットフォーム対応**:ほとんどのAIプラットフォームをサポートし、カスタムプロンプトによる並列・高性能なAI翻訳を実現します。
|
||||
- ✅ **非同期サポート**:高性能なシーン向けに設計され、完全な非同期サポートを提供し、マルチタスク並列処理が可能なサービスインターフェースを実現しています。
|
||||
- ✅ **LAN、複数人利用をサポート**:LAN内での複数人による同時利用をサポートします。
|
||||
- ✅ **インタラクティブなWeb UI**:すぐに使えるWeb UIとRESTful APIを提供し、統合や利用が容易です。
|
||||
- ✅ **小容量・マルチプラットフォーム対応の簡単パッケージ**:40MB未満のWindows、Mac用簡単パッケージ(`docling`によるローカルPDF解析を使用しないバージョン)。
|
||||
- ✅ **小容量・マルチプラットフォーム対応の簡単パッケージ**:40MB未満のWindows、Mac用簡単パッケージ(`docling`
|
||||
によるローカルPDF解析を使用しないバージョン)。
|
||||
|
||||
> `pdf`を翻訳する際、一度Markdownに変換されるため、元のレイアウトが**失われます**。レイアウトを重視するユーザーはご注意ください。
|
||||
|
||||
@@ -46,7 +48,8 @@
|
||||
|
||||
## 統合パッケージ
|
||||
|
||||
すぐに使い始めたいユーザーのために、[GitHub Releases](https://github.com/xunbu/docutranslate/releases) で統合パッケージを提供しています。ダウンロードして解凍し、お使いのAIプラットフォームのAPIキーを入力するだけで使用を開始できます。
|
||||
すぐに使い始めたいユーザーのために、[GitHub Releases](https://github.com/xunbu/docutranslate/releases)
|
||||
で統合パッケージを提供しています。ダウンロードして解凍し、お使いのAIプラットフォームのAPIキーを入力するだけで使用を開始できます。
|
||||
|
||||
- **DocuTranslate**: 標準版。オンラインの`minerU`エンジンを使用してPDFドキュメントを解析します。ローカルでのPDF解析が不要な場合はこちらを選択してください(推奨)。
|
||||
- **DocuTranslate_full**: 完全版。`docling`ローカルPDF解析エンジンを内蔵しています。ローカルでのPDF解析が必要な場合はこちらを選択してください。
|
||||
@@ -90,12 +93,15 @@ uv sync
|
||||
|
||||
## 中心的な概念:ワークフロー (Workflow)
|
||||
|
||||
新バージョンのDocuTranslateの核心は**ワークフロー (Workflow)**です。各ワークフローは、特定のファイルタイプ専用に設計された、完全なエンドツーエンドの翻訳パイプラインです。もはや巨大なクラスと対話するのではなく、ファイルタイプに応じて適切なワークフローを選択し、設定します。
|
||||
新バージョンのDocuTranslateの核心は**ワークフロー (Workflow)**
|
||||
です。各ワークフローは、特定のファイルタイプ専用に設計された、完全なエンドツーエンドの翻訳パイプラインです。もはや巨大なクラスと対話するのではなく、ファイルタイプに応じて適切なワークフローを選択し、設定します。
|
||||
|
||||
**基本的な使用手順は以下の通りです:**
|
||||
|
||||
1. **ワークフローの選択**:入力ファイルの種類(例:PDF/WordまたはTXT)に応じて、`MarkdownBasedWorkflow`や`TXTWorkflow`などのワークフローを選択します。
|
||||
2. **設定の構築**:選択したワークフローに対応する設定オブジェクト(例:`MarkdownBasedWorkflowConfig`)を作成します。この設定オブジェクトには、必要なすべてのサブ設定が含まれています。
|
||||
1. **ワークフローの選択**:入力ファイルの種類(例:PDF/WordまたはTXT)に応じて、`MarkdownBasedWorkflow`や`TXTWorkflow`
|
||||
などのワークフローを選択します。
|
||||
2. **設定の構築**:選択したワークフローに対応する設定オブジェクト(例:`MarkdownBasedWorkflowConfig`
|
||||
)を作成します。この設定オブジェクトには、必要なすべてのサブ設定が含まれています。
|
||||
* **コンバータ設定 (Converter Config)**: 元のファイル(例:PDF)をMarkdownに変換する方法を定義します。
|
||||
* **翻訳機設定 (Translator Config)**: 使用するLLM、APIキー、ターゲット言語などを定義します。
|
||||
* **エクスポータ設定 (Exporter Config)**: 出力フォーマット(例:HTML)の特定のオプションを定義します。
|
||||
@@ -106,7 +112,7 @@ uv sync
|
||||
## 利用可能なワークフロー
|
||||
|
||||
| ワークフロー | 適用シーン | 入力フォーマット | 出力フォーマット | 主要設定クラス |
|
||||
| :--- | :--- | :--- | :--- | :--- |
|
||||
|:----------------------------|:-----------------------------------------------------------------------|:------------------------------------------|:-----------------------|:------------------------------|
|
||||
| **`MarkdownBasedWorkflow`** | PDF、Word、画像などのリッチテキストドキュメントを処理。フロー:`ファイル -> Markdown -> 翻訳 -> エクスポート`。 | `.pdf`, `.docx`, `.md`, `.png`, `.jpg` など | `.md`, `.zip`, `.html` | `MarkdownBasedWorkflowConfig` |
|
||||
| **`TXTWorkflow`** | プレーンテキストドキュメントを処理。フロー:`txt -> 翻訳 -> エクスポート`。 | `.txt` およびその他のプレーンテキスト形式 | `.txt`, `.html` | `TXTWorkflowConfig` |
|
||||
| **`JsonWorkflow`** | JSONファイルを処理。フロー:`json -> 翻訳 -> エクスポート`。 | `.json` | `.json`, `.html` | `JsonWorkflowConfig` |
|
||||
@@ -256,7 +262,8 @@ if __name__ == "__main__":
|
||||
|
||||
### 例3: JSONファイルの翻訳 (`JsonWorkflow`を使用)
|
||||
|
||||
ここでは非同期方式を例にとります。`JsonTranslatorConfig`の`json_paths`項目で翻訳対象のJSONパスを指定する必要があります(`jsonpath-ng`構文仕様に準拠)。JSONパスにマッチした値のみが翻訳されます。
|
||||
ここでは非同期方式を例にとります。`JsonTranslatorConfig`の`json_paths`項目で翻訳対象のJSONパスを指定する必要があります(
|
||||
`jsonpath-ng`構文仕様に準拠)。JSONパスにマッチした値のみが翻訳されます。
|
||||
|
||||
```python
|
||||
import asyncio
|
||||
@@ -414,7 +421,7 @@ if __name__ == "__main__":
|
||||
> deepseek-chat`など。
|
||||
|
||||
| プラットフォーム名 | APIキーの取得 | baseurl |
|
||||
| :--- | :--- | :--- |
|
||||
|:-----------|:------------------------------------------------------------------------------------------|:---------------------------------------------------------|
|
||||
| ollama | | http://127.0.0.1:11434/v1 |
|
||||
| lm studio | | http://127.0.0.1:1234/v1 |
|
||||
| openrouter | [クリックして取得](https://openrouter.ai/settings/keys) | https://openrouter.ai/api/v1 |
|
||||
@@ -441,9 +448,11 @@ if __name__ == "__main__":
|
||||
|
||||
### 2.2. doclingエンジンの設定 (ローカルPDF解析)
|
||||
|
||||
ドキュメント解析エンジンとして`docling`を選択した場合(`convert_engine="docling"`)、初回使用時にHugging Faceから必要なモデルがダウンロードされます。
|
||||
ドキュメント解析エンジンとして`docling`を選択した場合(`convert_engine="docling"`)、初回使用時にHugging
|
||||
Faceから必要なモデルがダウンロードされます。
|
||||
|
||||
> より良い選択肢は、[github releases](https://github.com/xunbu/docutranslate/releases)から`docling_artifact.zip`をダウンロードし、作業ディレクトリに展開することです。
|
||||
> より良い選択肢は、[github releases](https://github.com/xunbu/docutranslate/releases)から`docling_artifact.zip`
|
||||
> をダウンロードし、作業ディレクトリに展開することです。
|
||||
|
||||
**`docling`モデルのダウンロードに関するネットワーク問題の解決策:**
|
||||
|
||||
@@ -486,16 +495,20 @@ A: `-p` パラメータを使用して新しいポートを指定するか、`DO
|
||||
A: はい、サポートしています。強力なOCR機能を持つ`mineru`解析エンジンを使用してください。
|
||||
|
||||
**Q: 初回のPDF翻訳が非常に遅いのはなぜですか?**
|
||||
A: `docling`エンジンを使用している場合、初回実行時にHugging Faceからモデルをダウンロードする必要があります。このプロセスを高速化するには、上記の「ネットワーク問題の解決策」を参照してください。
|
||||
A: `docling`エンジンを使用している場合、初回実行時にHugging
|
||||
Faceからモデルをダウンロードする必要があります。このプロセスを高速化するには、上記の「ネットワーク問題の解決策」を参照してください。
|
||||
|
||||
**Q: LAN(オフライン)環境で使用するにはどうすればよいですか?**
|
||||
A: 完全に可能です。以下の条件を満たす必要があります:
|
||||
|
||||
1. **ローカルLLM**: [Ollama](https://ollama.com/) や [LM Studio](https://lmstudio.ai/) などのツールを使用して言語モデルをローカルにデプロイし、`TranslatorConfig`にローカルモデルの`base_url`を記入します。
|
||||
1. **ローカルLLM**: [Ollama](https://ollama.com/) や [LM Studio](https://lmstudio.ai/) などのツールを使用して言語モデルをローカルにデプロイし、
|
||||
`TranslatorConfig`にローカルモデルの`base_url`を記入します。
|
||||
2. **ローカルPDF解析エンジン**(PDF解析が必要な場合のみ): `docling`エンジンを使用し、上記の「オフラインでの使用」の指示に従って事前にモデルパッケージをダウンロードします。
|
||||
|
||||
**Q: PDF解析のキャッシュメカニズムはどのように機能しますか?**
|
||||
A: `MarkdownBasedWorkflow`は、ドキュメント解析(ファイルからMarkdownへの変換)の結果を自動的にキャッシュし、時間とリソースの重複消費を防ぎます。キャッシュはデフォルトでメモリに保存され、直近10回の解析結果が記録されます。キャッシュ数は`DOCUTRANSLATE_CACHE_NUM`環境変数で変更できます。
|
||||
A: `MarkdownBasedWorkflow`
|
||||
は、ドキュメント解析(ファイルからMarkdownへの変換)の結果を自動的にキャッシュし、時間とリソースの重複消費を防ぎます。キャッシュはデフォルトでメモリに保存され、直近10回の解析結果が記録されます。キャッシュ数は
|
||||
`DOCUTRANSLATE_CACHE_NUM`環境変数で変更できます。
|
||||
|
||||
**Q: ソフトウェアがプロキシ経由で通信するようにするにはどうすればよいですか?**
|
||||
A: デフォルトではプロキシを使用しません。環境変数`DOCUTRANSLATE_PROXY_ENABLED`を`true`に設定することで、プロキシ経由での通信が可能になります。
|
||||
@@ -509,3 +522,11 @@ A: デフォルトではプロキシを使用しません。環境変数`DOCUTRA
|
||||
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=xunbu/docutranslate&type=Date" />
|
||||
</picture>
|
||||
</a>
|
||||
|
||||
## 応援サポート
|
||||
|
||||
作者へのサポートを歓迎します。備考欄に応援の理由を記載していただけると幸いです。
|
||||
|
||||
<p align="center">
|
||||
<img src="./images/赞赏码.jpg" alt="赞赏码" style="width: 50vw">
|
||||
</p>
|
||||
@@ -513,3 +513,11 @@ A: 软件默认不使用代理,可以通过设置环境变量`DOCUTRANSLATE_PR
|
||||
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=xunbu/docutranslate&type=Date" />
|
||||
</picture>
|
||||
</a>
|
||||
|
||||
## 赞赏支持
|
||||
|
||||
欢迎支持作者,烦请在备注中说明一下赞赏原因哟
|
||||
|
||||
<p align="center">
|
||||
<img src="./images/赞赏码.jpg" alt="赞赏码" style="width: 50vw">
|
||||
</p>
|
||||
BIN
images/赞赏码.jpg
Normal file
BIN
images/赞赏码.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 71 KiB |
Reference in New Issue
Block a user