{"id":13644995,"url":"https://github.com/junhoyeo/betterocr","last_synced_at":"2026-01-17T11:10:26.033Z","repository":{"id":204094192,"uuid":"710276604","full_name":"junhoyeo/BetterOCR","owner":"junhoyeo","description":"🔍 Better text detection by combining multiple OCR engines (EasyOCR, Tesseract, and Pororo) with 🧠 LLM.","archived":false,"fork":false,"pushed_at":"2025-01-27T15:00:37.000Z","size":11140,"stargazers_count":538,"open_issues_count":9,"forks_count":32,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-30T10:45:36.952Z","etag":null,"topics":["ai","chatgpt","chatgpt-api","easyocr","llm","ocr","openai","openai-api","tesseract","tesseract-ocr"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/junhoyeo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-26T11:26:25.000Z","updated_at":"2025-03-29T01:23:26.000Z","dependencies_parsed_at":"2024-05-11T22:25:20.093Z","dependency_job_id":"67fc55ae-fe95-442c-967d-604be4cdcf2b","html_url":"https://github.com/junhoyeo/BetterOCR","commit_stats":null,"previous_names":["junhoyeo/betterocr"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/junhoyeo%2FBetterOCR","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/junhoyeo%2FBetterOCR/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/junhoyeo%2FBetterOCR/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/junhoyeo%2FBetterOCR/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/junhoyeo","download_url":"https://codeload.github.com/junhoyeo/BetterOCR/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250048007,"owners_count":21366159,"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":["ai","chatgpt","chatgpt-api","easyocr","llm","ocr","openai","openai-api","tesseract","tesseract-ocr"],"created_at":"2024-08-02T01:02:23.367Z","updated_at":"2026-01-17T11:10:25.994Z","avatar_url":"https://github.com/junhoyeo.png","language":"Python","funding_links":["https://github.com/sponsors/junhoyeo"],"categories":["NLP"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/junhoyeo\"\u003e\n    \u003cimg src=\"https://github.com/junhoyeo/BetterOCR/raw/main/.github/images/logo.png\" width=\"256px\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\u003ch1 align=\"center\"\u003eBetterOCR\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://pypi.org/project/betterocr\"\u003e\u003cimg alt=\"PyPI\" src=\"https://img.shields.io/pypi/v/betterocr.svg?style=for-the-badge\u0026labelColor=162246\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/junhoyeo/betterocr/blob/main/LICENSE\"\u003e\u003cimg alt=\"MIT License\" src=\"https://img.shields.io/badge/license-MIT-blue?style=for-the-badge\u0026labelColor=162246\" /\u003e\u003c/a\u003e\n\u003cp\u003e\n\n\u003e 🔍 Better text detection by combining multiple OCR engines with 🧠 LLM.\n\nOCR _still_ sucks! ... Especially when you're from the _other side_ of the world (and face a significant lack of training data in your language) — or just not thrilled with noisy results.\n\n**BetterOCR** combines results from multiple OCR engines with an LLM to correct \u0026 reconstruct the output.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.githubassets.com/assets/public-sponsor-default-9fa68986b057.png\" width=\"64px\" /\u003e\u003cbr /\u003e\n  \u003cstrong\u003e\u003ca href=\"https://github.com/sponsors/junhoyeo\"\u003eMy open source work is supported by the community\u003c/a\u003e\u003c/strong\u003e\u003cbr /\u003e\n  Special thanks to \u003ca href=\"https://www.korgiftcard.io/\"\u003e(주)한국모바일상품권(Korea Mobile Git Card, Inc.)\u003c/a\u003e and others\n\u003c/p\u003e\n\n### 🔍 OCR Engines\nCurrently supports [EasyOCR](https://github.com/JaidedAI/EasyOCR) (JaidedAI), [Tesseract](https://github.com/tesseract-ocr/tesseract) (Google), and [Pororo](https://github.com/kakaobrain/pororo) (KakaoBrain).\n\n- For Pororo, we're using the code from https://github.com/black7375/korean_ocr_using_pororo \u003cbr /\u003e\n  (Pre-processing ➡️ _Text detection_ with EasyOCR ➡️ _Text recognition_ with BrainOCR (Pororo's OCR module)).\n- Pororo is used only if the language options (`lang`) specified include either 🇺🇸 English (`en`) or 🇰🇷 Korean (`ko`). Also additional dependencies listed in \u003ca href=\"https://github.com/junhoyeo/BetterOCR/blob/main/pyproject.toml#L22\"\u003e\u003ccode\u003e[tool.poetry.group.pororo.dependencies]\u003c/code\u003e\u003c/a\u003e must be available. (If not, it'll automatically be excluded from enabled engines.)\n\n### 🧠 LLM\nSupports [Chat models](https://github.com/openai/openai-python#chat-completions) from OpenAI.\n\n### 📒 Custom Context\nAllows users to provide an optional context to use specific keywords such as proper nouns and product names. This assists in spelling correction and noise identification, ensuring accuracy even with rare or unconventional words.\n\n### 🛢️ Resources\n\n- Head over to [💯 Examples](#-Examples) to view performace by languages (🇺🇸, 🇰🇷, 🇮🇳).\n- Coming Soon: ~~box detection~~ 🧪✅, improved interface 🚧, async support, and more. Contributions are welcomed.\n\n\u003e **Warning**\u003cbr/\u003e\n\u003e This package is under rapid development 🛠\n\n\u003ca href=\"https://github.com/junhoyeo\"\u003e\n  \u003cimg src=\"https://github.com/junhoyeo/BetterOCR/raw/main/.github/images/arch.jpg?v=2\" width=\"100%\" /\u003e\n\u003c/a\u003e\n\n\u003e Architecture\n\n## 🚀 Usage (WIP)\n\n```bash\npip install betterocr\n# pip3 install betterocr\n```\n\n```py\nimport betterocr\n\n# text detection\ntext = betterocr.detect_text(\n    \"demo.png\",\n    [\"ko\", \"en\"], # language codes (from EasyOCR)\n    context=\"\", # (optional) context\n    tesseract={\n      # Tesseract options here\n      \"config\": \"--tessdata-dir ./tessdata\"\n    },\n    openai={\n      # OpenAI options here\n\n      # `os.environ[\"OPENAI_API_KEY\"]` is used by default\n      \"API_KEY\": \"sk-xxxxxxx\",\n\n      # rest are used to pass params to `client.chat.completions.create`\n      # `{\"model\": \"gpt-4\"}` by default\n      \"model\": \"gpt-3.5-turbo\",\n    },\n)\nprint(text)\n```\n\n### 📦 Box Detection\n\n| Original | Detected |\n|:---:|:---:|\n| \u003cimg src=\"https://github.com/junhoyeo/BetterOCR/raw/main/.github/images/demo-1.png\" width=\"500px\" /\u003e | \u003cimg src=\"https://github.com/junhoyeo/BetterOCR/raw/main/.github/images/boxes-0.png\" width=\"500px\" /\u003e |\n\nExample Script: https://github.com/junhoyeo/BetterOCR/blob/main/examples/detect_boxes.py (Uses OpenCV and Matplotlib to draw rectangles)\n\n```py\nimport betterocr\n\nimage_path = \".github/images/demo-1.png\"\nitems = betterocr.detect_boxes(\n    image_path,\n    [\"ko\", \"en\"],\n    context=\"퍼멘테이션 펩타인 아이케어 크림\",  # product name\n    tesseract={\n        \"config\": \"--psm 6 --tessdata-dir ./tessdata -c tessedit_create_boxfile=1\"\n    },\n)\nprint(items)\n```\n\n\u003cdetails\u003e\n  \u003csummary\u003eView Output\u003c/summary\u003e\n\n```py\n[\n  {'text': 'JUST FOR YOU', 'box': [[543, 87], [1013, 87], [1013, 151], [543, 151]]},\n  {'text': '이런 분들께 추천드리는 퍼멘테이션 펩타인 아이케어 크림', 'box': [[240, 171], [1309, 171], [1309, 224], [240, 224]]},\n  {'text': '매일매일 진해지는 다크서클을 개선하고 싶다면', 'box': [[123, 345], [1166, 345], [1166, 396], [123, 396]]},\n  {'text': '축축 처지는 피부를 탄력 있게 바꾸고 싶다면', 'box': [[125, 409], [1242, 409], [1242, 470], [125, 470]]},\n  {'text': '나날이 늘어가는 눈가 주름을 완화하고 싶다면', 'box': [[123, 479], [1112, 479], [1112, 553], [123, 553]]},\n  {'text': 'FERMENATION', 'box': [[1216, 578], [1326, 578], [1326, 588], [1216, 588]]},\n  {'text': '민감성 피부에도 사용할 수 있는 아이크림을 찾는다면', 'box': [[134, 534], [1071, 534], [1071, 618], [134, 618]]},\n  {'text': '얇고 예민한 눈가 주변 피부를 관리하고 싶다면', 'box': [[173, 634], [1098, 634], [1098, 690], [173, 690]]}\n]\n```\n\n\u003c/details\u003e\n\n## 💯 Examples\n\n\u003e **Note**\u003cbr/\u003e\n\u003e Results may vary due to inherent variability and potential future updates to OCR engines or the OpenAI API.\n\n### Example 1 (English with Noise)\n\n\u003cimg src=\"https://github.com/junhoyeo/BetterOCR/raw/main/.github/images/demo-0.webp\" width=\"500px\" /\u003e\n\n| Source | Text |\n| ------ | ---- |\n| EasyOCR | `CHAINSAWMANChapter 109:The Easy Way to Stop Bullying~BV-THTSUKIFUUIMUTU ETT` |\n| Tesseract | `A\\ ira \\| LT ge a TE ay NS\\nye SE F Pa Ce YI AIG 44\\nopr See aC\\n; a) Ny 7S =u \\|\\n_ F2 SENN\\n\\ ZR\\n3 ~ 1 A \\ Ws —— “s 7 “A\\n=) 24 4 = rt fl /1\\n£72 7 a NS dA Chapter 109:77/ ¢ 4\\nZz % = ~ oes os \\| \\STheEasf Way.to Stop Bullying:\\n© Wa) ROT\\n\\n` |\n| Pororo | `CHAINSAWNAN\\nChapter 109\\nThe Easy Way.to Stop Bullying.\\nCBY=TATSUKI FUJIMDTO` |\n| LLM | 🤖 GPT-3.5 |\n| **Result** | **`CHAINSAW MAN\\n\\nChapter 109: The Easy Way to Stop Bullying\\n\\nBY: TATSUKI FUJIMOTO`** |\n\n### Example 2 (Korean+English)\n\n\u003cimg src=\"https://github.com/junhoyeo/BetterOCR/raw/main/.github/images/demo-1.png\" width=\"500px\" /\u003e\n\n| Source | Text |\n| ------ | ---- |\n| EasyOCR | `JUST FOR YOU이런 분들께 추천드리는 퍼멘테이선 팬타인 아이켜어 크림매일매일 진해지논 다크서클올 개선하고 싶다면축축 처지논 피부름 탄력 잇게 바꾸고 싶다면나날이 늘어가는 눈가 주름올 완화하고 싶다면FERMENATION민감성 피부에도 사용할 수잇는 아이크림올 찾는다면얇고 예민한 눈가 주변 피부름 관리하고 싶다면`                                                                              |\n| Tesseract | `9051 508 \\ㅇ4\\n이런 분들께 추천드리는 퍼멘테이션 타인 아이케어 크림\\n.매일매일 진해지는 다크서클을 개선하고 싶다면        \"도\\nㆍ축축 처지는 피부를 탄력 있게 바꾸고 싶다면         7\\nㆍ나날이 늘어가는 눈가 주름을 완화하고 싶다면        /\\n-민감성 피부에도 사용할 수 있는 아이크림을 찾는다면    (프\\nㆍ않고 예민한 눈가 주변 피부를 관리하고 싶다면                         밸\\n\\n` |\n| Pororo | `JUST FOR YOU\\n이런 분들께 추천드리는 퍼맨테이션 펩타인 아이케어 크림\\n매일매일 진해지는 다크서클을 개선하고 싶다면\\n촉촉 처지는 피부를 탄력 있게 바꾸고 싶다면\\n나날이 늘어가는 눈가 주름을 완화하고 싶다면\\nFERMENTATIOM\\n민감성 피부에도 사용할 수 있는 아이크림을 찾는다면\\n얇고 예민한 눈가 주변 피부를 관리하고 싶다면` |\n| LLM | 🤖 GPT-3.5 |\n| **Result** | **`JUST FOR YOU\\n이런 분들께 추천드리는 퍼멘테이션 펩타인 아이케어 크림\\n매일매일 진해지는 다크서클을 개선하고 싶다면\\n축축 처지는 피부를 탄력 있게 바꾸고 싶다면\\n나날이 늘어가는 눈가 주름을 완화하고 싶다면\\nFERMENTATION\\n민감성 피부에도 사용할 수 있는 아이크림을 찾는다면\\n얇고 예민한 눈가 주변 피부를 관리하고 싶다면`** |\n\n### Example 3 (Korean with custom `context`)\n\n\u003cimg src=\"https://github.com/junhoyeo/BetterOCR/raw/main/.github/images/demo-2.png\" width=\"400px\" /\u003e\n\n| Source | Text |\n| ------ | ---- |\n| EasyOCR | `바이오함보#세로모공존존세럼6글로우픽 설문단 100인이꼼꼼하게 평가햇어요\"#누적 판매액 40억#제품만족도 1009` |\n| Tesseract | `바이오힐보\\n#세로모공폰폰세럼\\n“글로 으피 석무다 1 00인이\\n꼼꼼하게평가했어요”\\n\\n` |\n| Pororo | `바이오힐보\\n#세로모공쫀쫀세럼\\n'.\\n'글로우픽 설문단 100인이\\n꼼꼼하게 평가했어요'\"\\n#누적 판매액 40억\\n# 제품 만족도 100%` |\n| Context | `[바이오힐보] 세로모공쫀쫀세럼으로 콜라겐 타이트닝! (6S)` |\n| LLM | 🤖 GPT-4 |\n| **Result** | **`바이오힐보\\n#세로모공쫀쫀세럼\\n글로우픽 설문단 100인이 꼼꼼하게 평가했어요\\n#누적 판매액 40억\\n#제품 만족도 100%`** |\n\n#### 🧠 LLM Reasoning (*Old)\n\nBased on the given OCR results and the context, here is the combined and corrected result:\n\n```\n{\n  \"data\": \"바이오힐보\\n#세로모공쫀쫀세럼\\n글로우픽 설문단 100인이 꼼꼼하게 평가했어요\\n#누적 판매액 40억\\n#제품만족도 100%\"\n}\n```\n\n- `바이오힐보` is the correct brand name, taken from [1] and the context.\n- `#세로모공쫀쫀세럼` seems to be the product name and is derived from the context.\n- `글로우픽 설문단 100인이 꼼꼼하게 평가했어요` is extracted and corrected from both OCR results.\n- `#누적 판매액 40억` is taken from [0].\n- `#제품만족도 100%` is corrected from [0].\n\n### Example 4 (Hindi)\n\n\u003cimg src=\"https://github.com/junhoyeo/BetterOCR/raw/main/.github/images/demo-3.webp\" width=\"500px\" /\u003e\n\n| Source | Text |\n| ------ | ---- |\n| EasyOCR | `` `७नवभारतटाइम्सतोक्यो ओलिंपिक के लिए भारतीय दलका थीम सॉन्ग लॉन्च कर दिया गयाबुधवार को इस सॉन्ग को किया गया लॉन्चसिंगर मोहित चौहान ने दी है आवाज7लखेल मंत्री किरण रिजिजू ने ट्विटर पर शेयरकिया थीम सॉन्ग का वीडियो0ब४0 २०२०गीत का नाम- '्लक्ष्य तेरा सामने है' , खेलमंत्री ने ५७ सेकंड का वीडियो किया शेयर `` |\n| Tesseract | `'8ा.\\nनवभोरत टैइम्स\\n\\nतोक्यो ओलिंपिक के लिंए भारतीय दल\\n\\nका थीम सॉन्ग लॉन्च कर दिया गया\\n\\nबुधवार को हस सॉन्ग को किया गया लॉन्च\\nसिंगर मोहित चौहान ने दी है आवाज\\n\\nखेल मंत्री किरण रिजिजू ने द्विटर पर शेयर\\nकिया थीम सॉन्ग का वीडियो\\n\\nपृ 0 (९ है 0 2 0 2 0 गीत का नाम- 'लक्ष्य तेरा सामने है', खेल\\n\\n(2 (9९) मंत्री ने 57 सेकंड का वीडियो किया शेयर\\n\\n` |\n| LLM | 🤖 GPT-4 |\n| **Result** | **`नवभारत टाइम्स\\nतोक्यो ओलिंपिक के लिए भारतीय दल का थीम सॉन्ग लॉन्च कर दिया गया\\nबुधवार को इस सॉन्ग को किया गया लॉन्च\\nसिंगर मोहित चौहान ने दी है आवाज\\n\\nखेल मंत्री किरण रिजिजू ने ट्विटर पर शेयर किया थीम सॉन्ग का वीडियो\\n2020 गीत का नाम- 'लक्ष्य तेरा सामने है', खेल मंत्री ने 57 सेकंड का वीडियो किया शेयर`** |\n\n## License (Starmie!)\n\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003eMIT © \u003ca href=\"https://github.com/junhoyeo\"\u003eJunho Yeo\u003c/a\u003e\u003c/strong\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/junhoyeo\"\u003e\n    \u003cimg src=\"https://github.com/junhoyeo/BetterOCR/raw/main/.github/images/starmie.jpg\" width=\"256px\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\nIf you find this project interesting, **please consider giving it a star(⭐)** and following me on [GitHub](https://github.com/junhoyeo). I code 24/7 and ship mind-breaking things on a regular basis, so your support definitely won't be in vain!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjunhoyeo%2Fbetterocr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjunhoyeo%2Fbetterocr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjunhoyeo%2Fbetterocr/lists"}