更新readme

This commit is contained in:
xunbu
2025-05-21 21:09:21 +08:00
parent 380b4d7dc9
commit 2bf329fd34
4 changed files with 34 additions and 32 deletions

11
.idea/workspace.xml generated
View File

@@ -5,17 +5,10 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="6b18b44a-df57-4212-a857-9e291ebe5dd2" name="更改" comment=""> <list default="true" id="6b18b44a-df57-4212-a857-9e291ebe5dd2" name="更改" comment="">
<change afterPath="$PROJECT_DIR$/docutranslate/static/DocuTranslate.ico" afterDir="false" /> <change afterPath="$PROJECT_DIR$/images/双语对照.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/full_onefile.spec" afterDir="false" />
<change afterPath="$PROJECT_DIR$/requirements.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" /> <change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/docutranslate/app.py" beforeDir="false" afterPath="$PROJECT_DIR$/docutranslate/app.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/docutranslate/converter/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/docutranslate/converter/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/docutranslate/static/index.html" beforeDir="false" afterPath="$PROJECT_DIR$/docutranslate/static/index.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/full.spec" beforeDir="false" afterPath="$PROJECT_DIR$/full.spec" afterDir="false" /> <change beforePath="$PROJECT_DIR$/full.spec" beforeDir="false" afterPath="$PROJECT_DIR$/full.spec" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pyproject.toml" beforeDir="false" afterPath="$PROJECT_DIR$/pyproject.toml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/uv.lock" beforeDir="false" afterPath="$PROJECT_DIR$/uv.lock" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -611,7 +604,7 @@
<workItem from="1747740341909" duration="145000" /> <workItem from="1747740341909" duration="145000" />
<workItem from="1747752718385" duration="81000" /> <workItem from="1747752718385" duration="81000" />
<workItem from="1747754618316" duration="16566000" /> <workItem from="1747754618316" duration="16566000" />
<workItem from="1747828300140" duration="3391000" /> <workItem from="1747828300140" duration="4611000" />
</task> </task>
<servers /> <servers />
</component> </component>

View File

@@ -8,29 +8,34 @@
> QQ交流群1047781902 > QQ交流群1047781902
![翻译效果](/images/双语对照.png)
# 整合包 # 整合包
对于只使用基本翻译功能的用户,可以在[github releases](https://github.com/xunbu/docutranslate/releases) - 对于只使用基本翻译功能的用户,可以在[github releases](https://github.com/xunbu/docutranslate/releases)
上下载最新的整合包该整合包点击即用您所需的只是获取某个ai平台的api-key 上下载最新的整合包该整合包点击即用您所需的只是获取某个ai平台的api-key和minerU的token
以及可以在mineru申请token进行pdf识别【可选 - 名字为DocuTranslate的软件不支持docling需要在minerU申请token进行文档解析【推荐
- 名字为DocuTranslate_full的软件包自带docling模型支持docling与minerU等所有解析文档引擎
对于轻量版只支持minerU转换引擎因此需要申请minerU的API-Token
# 安装 # 安装
使用pip 使用pip
1. `pip install docutranslate`
2. `pip install docling`#如果使用docling进行文档解析
使用uv `pip install docutranslate`
1. `uv init` `pip install docutranslate[docling]`#如果需要使用docling进行文档解析
2. `uv add docutranslate`
3. `uv add docling`#如果使用docling进行文档解析 使用uv
1. `uv init`
2. `uv add docutranslate`
3. `uv add docling`#如果需要使用docling进行文档解析
使用git 使用git
1. `git clone https://github.com/xunbu/docutranslate.git` 1. `git clone https://github.com/xunbu/docutranslate.git`
2. `uv sync` 2. `uv sync`
3. `uv pip install -U -e .` 3. `uv pip install -e .`
# 支持的文件格式 # 支持的文件格式
| 输入格式 | 输出格式 | | 输入格式 | 输出格式 |
@@ -50,10 +55,19 @@
1. 使用文本转换引擎将文档转换成markdown有docling本地、minerU联网两种引擎 1. 使用文本转换引擎将文档转换成markdown有docling本地、minerU联网两种引擎
2. 使用大语言模型翻译markdown文本需要申请api-key或本地部署 2. 使用大语言模型翻译markdown文本需要申请api-key或本地部署
## 使用minerU引擎注意事项minerU Token获取方式
使用minerU将文档转换为markdown时需要在minerU平台申请token
1. 打开[minerU官网](https://mineru.net/apiManage/docs)申请token
2. 申请成功后,在[API Token管理界面](https://mineru.net/apiManage/token)创建API Token
## 使用docling引擎注意事项 ## 使用docling引擎注意事项
使用docling将文档转换为markdown时需要下载模型到本地也可以提前下载见FAQ因此可能会遇到一些网络问题 使用docling将文档转换为markdown时需要下载模型到本地也可以提前下载见FAQ因此可能会遇到一些网络问题
可以在[github release](https://github.com/xunbu/docutranslate/releases)中下载docling_artifact压缩包将该压缩包解压放置在项目下可以解决模型下载的网络问题
### huggingface换源 ### huggingface换源
> 不能科学上网的友友注意了 > 不能科学上网的友友注意了
@@ -80,13 +94,6 @@ os.environ['HF_ENDPOINT'] = 'https://hf-mirror.com'
###其余代码写在下方 ###其余代码写在下方
``` ```
## 使用minerU引擎注意事项
使用minerU将文档转换为markdown时需要在minerU平台申请token
1. 打开[minerU官网](https://mineru.net/apiManage/docs)申请token
2. 申请成功后,在[API Token管理界面](https://mineru.net/apiManage/token)创建API Token
## 获取大模型平台的baseurl、key、model-id ## 获取大模型平台的baseurl、key、model-id
由于需要使用大语言模型进行markdown调整与翻译所以需要预先获取模型的baseurl、key、model-id 由于需要使用大语言模型进行markdown调整与翻译所以需要预先获取模型的baseurl、key、model-id
@@ -118,8 +125,8 @@ from docutranslate.translater import FileTranslater
translater = FileTranslater(base_url="<baseurl>", translater = FileTranslater(base_url="<baseurl>",
key="<key>", key="<key>",
model_id="<model-id>", model_id="<model-id>",
convert_engin="mineru",# 使用mineru解析文档 convert_engin="mineru", # 使用mineru解析文档
mineru_token="<申请的mineru_token>"#使用mineru时必填 mineru_token="<申请的mineru_token>" # 使用mineru时必填
# convert_engin="docling" # 使用docling解析文档 # convert_engin="docling" # 使用docling解析文档
) )
@@ -185,7 +192,9 @@ translater = FileTranslater(base_url="<baseurl>", # 默认的模型baseurl
) )
``` ```
> 使用docling需要先`pip install docling`或`uv add docling` > 使用docling需要先`pip install docling`或`uv add docling`
### 翻译文件 ### 翻译文件
```python ```python

View File

@@ -29,7 +29,7 @@ exe = EXE(
a.scripts, a.scripts,
[], [],
exclude_binaries=True, exclude_binaries=True,
name='DocuTranslate', name='DocuTranslate_full',
debug=False, debug=False,
bootloader_ignore_signals=False, bootloader_ignore_signals=False,
strip=False, strip=False,
@@ -49,5 +49,5 @@ coll = COLLECT(
strip=False, strip=False,
upx=True, upx=True,
upx_exclude=[], upx_exclude=[],
name='DocuTranslate', name='DocuTranslate_full',
) )

BIN
images/双语对照.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 676 KiB