{"id":22974383,"url":"https://github.com/diversen/gpt-translator","last_synced_at":"2025-04-02T07:25:08.832Z","repository":{"id":204615990,"uuid":"706613650","full_name":"diversen/gpt-translator","owner":"diversen","description":"Convert a large text into another language or another style. ","archived":false,"fork":false,"pushed_at":"2024-01-06T12:19:19.000Z","size":203,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-07T22:28:34.330Z","etag":null,"topics":["gpt","gpt-translation","gpt-translator","translation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/diversen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-18T09:41:56.000Z","updated_at":"2024-09-01T21:12:37.000Z","dependencies_parsed_at":"2023-11-11T13:23:37.169Z","dependency_job_id":"82c4b986-54a4-4810-b1d0-778b3a4a18e0","html_url":"https://github.com/diversen/gpt-translator","commit_stats":null,"previous_names":["diversen/gpt-translator"],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diversen%2Fgpt-translator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diversen%2Fgpt-translator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diversen%2Fgpt-translator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diversen%2Fgpt-translator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/diversen","download_url":"https://codeload.github.com/diversen/gpt-translator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246771762,"owners_count":20831096,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gpt","gpt-translation","gpt-translator","translation"],"created_at":"2024-12-15T00:00:38.920Z","updated_at":"2025-04-02T07:25:08.817Z","avatar_url":"https://github.com/diversen.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"### gpt-translator\n\nThis can translate large (and small) text files using the OpenAI API.\n\nExamle usage:\n\n* Convert complex text to simple text.\n* Translate text between different languages.\n\nHow It Works:\n\nThe text is divided into sections, separated by two or more newlines.\nA paragraph is a collection of sections, with a default size limit of e.g. 1024 tokens.\n\nEach paragraph is translated using the OpenAI API. The original text and the translated text is\ninserted into a sqlite3 database.\n\n### Usage\n\nYou need to have an openai API key. \n\nAdd your openai API key to your environment, e.g. in .bashrc \n\n```bash\nexport OPENAI_API_KEY=your-api-key\n```\n\nOr add the openai API key to a `.env` file in the directory where you execute `gpt-translator`\n\n```bash\nOPENAI_API_KEY=your-api-key\n```\n\n### Usage as command line tool\n\nInstall latest version using pipx\n\n\u003c!-- LATEST-VERSION-PIPX --\u003e\n\tpipx install git+https://github.com/diversen/gpt-translator@v0.2.6\n\n```bash\ngpt-translator translate --help\n ```\n    Usage: gpt-translator translate [OPTIONS]\n\n    Options:\n    -f, --from-file TEXT      Source file for translation.  [required]\n    -p, --prompt TEXT         Prompt for translation.  [required]\n    -d, --working-dir TEXT    Working directory. Default is 'output'\n    -m, --max-tokens INTEGER  Max tokens per paragraph. Default is 1024\n    -i, --idxs INTEGER        Translate specific paragraphs by index. Default is\n                                None\n    --failure-sleep INTEGER   Failure sleep time. Default is 10 seconds\n    --temperature FLOAT       Temperature. Default is 0.7\n    --presence-penalty FLOAT  Presence penalty. Default is 0.1\n    --top-p FLOAT             Top P. Default is 0.99\n    --model TEXT              Model to use. Default is gpt-3.5-turbo\n    --separator BOOLEAN       When exporting text, include part separator.\n                                Default is False\n    --help                    Show this message and exit.\n\nExample: \n\nTranslate a text file (markdown in this case):\n\n```bash\ngpt-translator translate -f input/hamlet_part.md -p \"Translate the following two scenes from Hamlet by Shakespeare to a modern version so that it is easier to understand. It should be as simple as possible, but no simpler.\"\n```\n\nThe translation will be placed in the `output` directory. In this case the translated text will be placed in a file named `hamlet_part_translated.md`.\n\nUpdate a translation by idxs:\n\n```bash\ngpt-translator translate -f input/hamlet_part.md --separator true --prompt  \"Please translate a part of Hamlet to Sindarin (Tolkien dialect). Here is the text you should translate: \" --idxs 2\n```\n\nRemove database:\n\n```bash\ngpt-translator cleanup\n```\n\n### Usage as requirement\n\n\u003c!-- LATEST-VERSION-PIP --\u003e\n\tpip install git+https://github.com/diversen/gpt-translator@v0.2.5\n\nFor usage see [translate.py](translate.py)\n\n### License\n\nMIT © [Dennis Iversen](https://github.com/diversen)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiversen%2Fgpt-translator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiversen%2Fgpt-translator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiversen%2Fgpt-translator/lists"}