English | 中文
GLM Translator is a tool that uses AI technology to translate English PDF books into Chinese. This tool utilizes large language models (LLMs), specifically the ChatGLM model by Zhipu. It is built with Python and features a flexible, modular, and object-oriented design.
In the current environment, there is a lack of non-commercial yet effective PDF translation tools. Many users have PDF files containing sensitive data and prefer not to upload them to public commercial services to protect their privacy. This project aims to solve this problem by providing a solution for users who need to translate their PDF files while maintaining data privacy.
GLM Translator is still in the early stages of development, and I am actively adding more features and improving its performance. Any feedback or contributions are highly welcome!
"OHenry Novel selected"
"The Old Man and the Sea"
- Use large language models (LLMs) to translate English PDF books into Chinese.
- Support for the ChatGLM model.
- Flexible configuration through YAML files or command line parameters.
- Robust timeout and error handling for translation operations.
- Modular and object-oriented design, easy to customize and extend.
- Add support for other languages and translation directions.
- Implement a graphical user interface (GUI) for easier use.
- Implement stylized translation.
- Implement partial page translation (e.g., first x pages).
- Create a web service or API for use in web applications.
- Add support for batch processing of multiple PDF files.
- Add support for retaining the original layout and formatting of the source PDF.
- Improve translation quality by using custom-trained translation models.
-
-
Clone the repository.
-
GLM Translator requires Python 3.10 or higher. Install the dependencies using
pip install -r requirements.txt
.
- Place your PDF file in the
input
directory. - Run the translator using
python translate.py
. - The translated PDF will be saved in the
output
directory.
--input
: Specify the input PDF file.--output
: Specify the output directory.--language
: Set the target translation language (default: Chinese).--model
: Specify the model to use (default: ChatGLM).--timeout
: Set the timeout for translation operations.
You can configure GLM Translator using a YAML file. Below is an example:
input: 'input/sample.pdf' output: 'output/' language: 'Chinese' model: 'ChatGLM' timeout: 600
We welcome contributions to the GLM Translator project. If you would like to contribute, please fork the repository, make your changes, and submit a pull request.
This project is licensed under the MIT License - see the
LICENSE
file for details.- Zhipu's ChatGLM team for developing the model.
- The open-source community for providing the tools and libraries used in this project.
-