{"id":51262969,"url":"https://github.com/zouari-oss/chunk-translator","last_synced_at":"2026-06-29T13:32:06.591Z","repository":{"id":344949631,"uuid":"1182777591","full_name":"zouari-oss/chunk-translator","owner":"zouari-oss","description":"FastAPI endpoint for chunked text translation","archived":false,"fork":false,"pushed_at":"2026-03-17T03:05:15.000Z","size":843,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-17T12:40:14.922Z","etag":null,"topics":["api","fastapi","json","open-source","python","rest","rest-api","translator"],"latest_commit_sha":null,"homepage":"https://chunk-translator.vercel.app","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zouari-oss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-16T00:13:21.000Z","updated_at":"2026-03-17T03:05:19.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/zouari-oss/chunk-translator","commit_stats":null,"previous_names":["zouari-oss/chunk-translator"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/zouari-oss/chunk-translator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zouari-oss%2Fchunk-translator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zouari-oss%2Fchunk-translator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zouari-oss%2Fchunk-translator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zouari-oss%2Fchunk-translator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zouari-oss","download_url":"https://codeload.github.com/zouari-oss/chunk-translator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zouari-oss%2Fchunk-translator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34929698,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-29T02:00:05.398Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["api","fastapi","json","open-source","python","rest","rest-api","translator"],"created_at":"2026-06-29T13:32:06.019Z","updated_at":"2026-06-29T13:32:06.583Z","avatar_url":"https://github.com/zouari-oss.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- PROJECT SHIELDS --\u003e\n\n[![Contributors](https://img.shields.io/badge/CONTRIBUTORS-01-blue?style=plastic)](https://github.com/ZouariOmar/AgriGO/graphs/contributors)\n[![Forks](https://img.shields.io/badge/FORKS-00-blue?style=plastic)](https://github.com/ZouariOmar/AgriGO/network/members)\n[![Stargazers](https://img.shields.io/badge/STARS-01-blue?style=plastic)](https://github.com/ZouariOmar/AgriGO/stargazers)\n[![Issues](https://img.shields.io/badge/ISSUES-00-blue?style=plastic)](https://github.com/ZouariOmar/AgriGO/issues)\n[![GPL3.0 License](https://img.shields.io/badge/LICENSE-GPL3.0-blue?style=plastic)](LICENSE)\n[![Linkedin](https://img.shields.io/badge/Linkedin-6.9k-blue?style=plastic)](https://www.linkedin.com/in/zouari-omar-143239283)\n\n\u003c!-- PROJECT HEADER --\u003e\n\u003ch1 align=\"center\"\u003e\n  \u003cbr\u003e\n  \u003ca href=\"https://github.com/zouari-oss/chunk-translator\"\u003e\u003cimg src=\"res/logo-without-bkg.png\" alt=\"chunk-translator\" width=\"400\"\u003e\u003c/a\u003e\n  \u003cbr\u003e\n  chunk-translator\n  \u003cbr\u003e\n\u003c/h1\u003e\n\n\u003ch4 align=\"center\"\u003eFastAPI endpoint for chunked text translation\u003c/h4\u003e\n\n\u003c!-- PROJECT LINKS --\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"#overview\"\u003eOverview\u003c/a\u003e •\n  \u003ca href=\"#key-features\"\u003eKey Features\u003c/a\u003e •\n  \u003ca href=\"#usage\"\u003eUsage\u003c/a\u003e •\n  \u003ca href=\"#emailware\"\u003eEmailware\u003c/a\u003e •\n  \u003ca href=\"#license\"\u003eLicense\u003c/a\u003e •\n  \u003ca href=\"#contact\"\u003eContact\u003c/a\u003e •\n  \u003ca href=\"#acknowledgments\"\u003eAcknowledgments\u003c/a\u003e\n\u003c/p\u003e\n\n\u003c!-- PROJECT TAGS --\u003e\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/python-3670A0?style=for-the-badge\u0026logo=python\u0026logoColor=ffdd54\" alt=\"Python\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/API-005571?style=for-the-badge\u0026logo=fastapi\u0026logoColor=white\" alt=\"API\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/FastAPI-009688?style=for-the-badge\u0026logo=fastapi\u0026logoColor=white\" alt=\"FastAPI\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/REST-02569B?style=for-the-badge\u0026logo=api\u0026logoColor=white\" alt=\"REST API\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/JSON-000000?style=for-the-badge\u0026logo=json\u0026logoColor=white\" alt=\"JSON\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Open%20Source-3DA639?style=for-the-badge\u0026logo=opensourceinitiative\u0026logoColor=white\"/\u003e\n\u003c/p\u003e\n\n## Overview\n\n**chunk-translator** is a lightweight API built with **FastAPI** that translates large text safely by splitting it into manageable chunks.\n\nMany translation models or APIs fail when processing very large inputs. This project solves that by:\n\n- Splitting large text into chunks\n- Translating each chunk independently\n- Reassembling the translated output in the correct order\n\n\u003e The result is reliable translation **without losing lines or breaking formatting**.\n\n## Key Features\n\n- **FastAPI powered REST API**\n- **Automatic text chunking**\n- **Supports large document translation**\n- **Reassembles chunks in correct order**\n- **Prevents dropped lines during translation**\n- **Simple JSON API interface**\n- **Easy to integrate into pipelines**\n\n## Usage\n\n### 1. Install dependencies\n\n```bash\npip install -r requirements.txt\n```\n\n### 2. Run the API\n\n```bash\nfastapi run\n```\n\n### 3. Use `/translate`\n\n\u003cdetails open\u003e\n\u003csummary\u003e\u003cstrong\u003ecurl\u003c/strong\u003e\u003c/summary\u003e\n\n```bash\ncurl -s \\\n  --header \"Content-Type: application/json\" \\\n  --request \"POST\" \\\n  --data '{\n    \"text\": \"Hello world\",\n    \"source_lang\": \"en\",\n    \"target_lang\": \"fr\"\n  }' \\\n  http://127.0.0.1:8000/translate\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eJavaScript (js)\u003c/strong\u003e\u003c/summary\u003e\n\n```js\nconst response = await fetch(\"http://127.0.0.1:8000/translate\", {\n  method: \"POST\",\n  headers: { \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    text: \"Hello world\",\n    source_lang: \"en\",\n    target_lang: \"fr\",\n  }),\n});\n\nconst data = await response.json();\nconsole.log(data);\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eJava\u003c/strong\u003e\u003c/summary\u003e\n\n```java\nimport java.net.URI;\nimport java.net.http.HttpClient;\nimport java.net.http.HttpRequest;\nimport java.net.http.HttpResponse;\n\npublic class TranslateClient {\n    public static void main(String[] args) throws Exception {\n        HttpClient client = HttpClient.newHttpClient();\n        String json = \"\"\"\n            {\n              \"text\": \"Hello world\",\n              \"source_lang\": \"en\",\n              \"target_lang\": \"fr\"\n            }\n            \"\"\";\n\n        HttpRequest request = HttpRequest.newBuilder()\n            .uri(URI.create(\"http://127.0.0.1:8000/translate\"))\n            .header(\"Content-Type\", \"application/json\")\n            .POST(HttpRequest.BodyPublishers.ofString(json))\n            .build();\n\n        HttpResponse\u003cString\u003e response = client.send(request, HttpResponse.BodyHandlers.ofString());\n        System.out.println(response.body());\n    }\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eC\u003c/strong\u003e\u003c/summary\u003e\n\n```c\n#include \u003ccurl/curl.h\u003e\n\nint main(void) {\n  CURL *curl = curl_easy_init();\n  if (!curl) return 1;\n\n  const char *json =\n    \"{\\\"text\\\":\\\"Hello world\\\",\\\"source_lang\\\":\\\"en\\\",\\\"target_lang\\\":\\\"fr\\\"}\";\n\n  struct curl_slist *headers = NULL;\n  headers = curl_slist_append(headers, \"Content-Type: application/json\");\n\n  curl_easy_setopt(curl, CURLOPT_URL, \"http://127.0.0.1:8000/translate\");\n  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);\n  curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json);\n  curl_easy_setopt(curl, CURLOPT_POST, 1L);\n  curl_easy_perform(curl);\n\n  curl_slist_free_all(headers);\n  curl_easy_cleanup(curl);\n  return 0;\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eC++ (cpp)\u003c/strong\u003e\u003c/summary\u003e\n\n```cpp\n#include \u003ccurl/curl.h\u003e\n#include \u003cstring\u003e\n\nint main() {\n  CURL* curl = curl_easy_init();\n  if (!curl) return 1;\n\n  std::string json =\n    R\"({\"text\":\"Hello world\",\"source_lang\":\"en\",\"target_lang\":\"fr\"})\";\n\n  struct curl_slist* headers = nullptr;\n  headers = curl_slist_append(headers, \"Content-Type: application/json\");\n\n  curl_easy_setopt(curl, CURLOPT_URL, \"http://127.0.0.1:8000/translate\");\n  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);\n  curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json.c_str());\n  curl_easy_setopt(curl, CURLOPT_POST, 1L);\n  curl_easy_perform(curl);\n\n  curl_slist_free_all(headers);\n  curl_easy_cleanup(curl);\n  return 0;\n}\n```\n\n\u003c/details\u003e\n\n### 4. Example Response\n\n```JSON\n{\n  \"status\": 200,\n  \"translated_text\": \"Translated output...\"\n}\n```\n\n## Emailware\n\nchunk-translator is an [emailware](https://en.wiktionary.org/wiki/emailware). Meaning, if you liked using this app or it has helped you in any way, I'd like you send me an email at \u003czouariomar20@gmail.com\u003e about anything you'd want to say about this software. I'd really appreciate it!\n\n## License\n\nThis repository is licensed under the **GPL-3.0 License**. You are free to use, modify, and distribute the content. See the [LICENSE](LICENSE) file for details.\n\n## Contact\n\nFor questions or suggestions, feel free to reach out:\n\n- **GitHub**: [ZouariOmar](https://github.com/ZouariOmar)\n- **Email**: \u003czouariomar20@gmail.com\u003e\n- **LinkedIn**: [Zouari Omar](https://www.linkedin.com/in/zouari-omar)\n\n## Acknowledgments\n\nBuilt with ❤️ for the open source community\n\n\u003e **Happy Coding!**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzouari-oss%2Fchunk-translator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzouari-oss%2Fchunk-translator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzouari-oss%2Fchunk-translator/lists"}