https://github.com/diversen/gpt-translate
An example on how to translate long documents using GPT.
https://github.com/diversen/gpt-translate
Last synced: about 1 year ago
JSON representation
An example on how to translate long documents using GPT.
- Host: GitHub
- URL: https://github.com/diversen/gpt-translate
- Owner: diversen
- Created: 2023-03-31T17:58:06.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-10-17T20:04:08.000Z (almost 3 years ago)
- Last Synced: 2025-05-06T14:58:12.829Z (about 1 year ago)
- Language: PHP
- Size: 296 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# README
This is minimal howto about translating a long text using GPT using php.
It may translate markdown texts, e.g. a novel, from one language to another.
It does the job quite well, but in any case you will need to edit
the translated document if you want a translation of high quality.
The auto-translation may serve as a good starting point.
It is only tested using markdown text. It will split a document into small
parts based on double lines. And then translate one section at a time.
## Usage
This example will make an effort to translate the first the part of the danish novel
'Lykke Per' (A Fortunate Man) into english.
git clone git@github.com:diversen/gpt-translate.git
cd gpt-translate
composer install
You will need to change the api key in [examples/example_1/index.php](examples/example_1/index.php)
Then run:
php examples/example_1/index.php
(There is also a couple of other examples).
## As library
composer require diversen/gpt-translate
Usage is the same as in [examples/example_1/index.php](examples/example_1/index.php)
## Related
This repo will try and fetch a URL and turn a html page into markdown:
https://github.com/diversen/url-to-markdown
## License
MIT © [Dennis Iversen](https://github.com/diversen)