MCPcopy Index your code
hub / github.com/discus0434/pdf-translator

github.com/discus0434/pdf-translator @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
446 symbols 1,075 edges 49 files 169 documented · 38%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

PDF Translator EN-JA

This repository offers an WebUI and API endpoint that translates English PDF files into Japanese, preserving the original layout.

Features

To be more readable, the translated PDF file displays the original PDF page in the left side and the translated text in the right side (see the image above).

To speed up the translation process, translation is performed until "References" section in the PDF file. After that, the rest of the page is copied as it is.

This repository contains some unsolved issues. Pull requests for improvements are always welcome.

Installation

  1. Clone this repository
   git clone https://github.com/discus0434/pdf-translator.git
   cd pdf-translator/docker
  1. Build the docker image via Makefile
   make build
  1. Run the docker container via Makefile
   make run

GUI Usage

Access to GUI via browser.

http://localhost:8288

CLI Usage

cd pdf-translator/docker && make translate INPUT="path/to/input_pdf_or_dir"

You can throw a PDF file or a directory containing PDF files.

The translated PDF files will be saved in ./outputs directory.

Requirements

  • NVIDIA GPU (currently only support NVIDIA GPU)
  • Docker

License

This repository does not allow commercial use.

This repository is licensed under CC BY-NC 4.0. See LICENSE for more information.

References

FuguMT models are distributed under the CC BY-SA 4.0 license. Please also note that the use is clearly stated as "for research purposes only" and that "no responsibility is assumed for operation or output".

TODOs

  • [ ] Make possible to highlight the translated text
  • [ ] Support M1 Mac or CPU

Contributors

Thanks to the following people who have contributed to this project:

  • Akira Ishino: Improvements on text truncation algorithm
  • hibit: Implementation of directory input to translator.py

Core symbols most depended-on inside this repo

get
called by 15
utils/ocr_model/ppocr_onnx/ppocr/utils/stats.py
run
called by 15
server/main.py
decode
called by 11
utils/ocr_model/ppocr_onnx/ppocr/postprocess/rec_postprocess.py
get_logger
called by 7
utils/ocr_model/ppocr_onnx/ppocr/utils/logging.py
sort_part_with_direction
called by 6
utils/ocr_model/ppocr_onnx/ppocr/utils/e2e_utils/extract_textpoint_fast.py
sort_part_with_direction
called by 6
utils/ocr_model/ppocr_onnx/ppocr/utils/e2e_utils/extract_textpoint_slow.py
intersection
called by 5
utils/ocr_model/ppocr_onnx/ppocr/postprocess/locality_aware_nms.py
column_width
called by 4
utils/textwrap_japanese.py

Shape

Method 239
Function 144
Class 63

Languages

Python100%

Modules by API surface

utils/ocr_model/ppocr_onnx/ppocr/postprocess/rec_postprocess.py79 symbols
utils/ocr_model/ppocr_onnx/ppocr/data/imaug/operators.py48 symbols
utils/ocr_model/ppocr_onnx/ppocr/utils/e2e_utils/extract_textpoint_slow.py23 symbols
utils/ocr_model/ppocr_onnx/tools/infer/utility.py21 symbols
utils/ocr_model/ppocr_onnx/ppocr/utils/e2e_utils/extract_textpoint_fast.py21 symbols
utils/ocr_model/ppocr_onnx/ppocr/postprocess/drrg_postprocess.py18 symbols
utils/ocr_model/ppocr_onnx/tools/infer/predict_rec.py14 symbols
utils/ocr_model/ppocr_onnx/ppocr/postprocess/sast_postprocess.py12 symbols
utils/ocr_model/ppocr_onnx/ppocr/postprocess/db_postprocess.py12 symbols
server/main.py12 symbols
utils/ocr_model/ppocr_onnx/ppocr/utils/utility.py11 symbols
utils/ocr_model/ppocr_onnx/ppocr/postprocess/table_postprocess.py11 symbols

For agents

$ claude mcp add pdf-translator \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page