betterocr


Namebetterocr JSON
Version 1.2.0 PyPI version JSON
download
home_page
SummaryBetter text detection by combining OCR engines with LLM.
upload_time2023-11-02 01:19:05
maintainer
docs_urlNone
authorJunho Yeo
requires_python>=3.11,<3.13
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align="center">
  <a href="https://github.com/junhoyeo">
    <img src="https://github.com/junhoyeo/BetterOCR/raw/main/.github/images/logo.png" width="256px" />
  </a>
</p>
<h1 align="center">BetterOCR</h1>

<p align="center">
<a href="https://pypi.org/project/betterocr"><img alt="PyPI" src="https://img.shields.io/pypi/v/betterocr.svg?style=for-the-badge&labelColor=162246" /></a>
<a href="https://github.com/junhoyeo/betterocr/blob/main/LICENSE"><img alt="MIT License" src="https://img.shields.io/badge/license-MIT-blue?style=for-the-badge&labelColor=162246" /></a>
<p>

> 🔍 Better text detection by combining multiple OCR engines with 🧠 LLM.

OCR _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.

**BetterOCR** combines results from multiple OCR engines with an LLM to correct & reconstruct the output.

### 🔍 OCR Engines
Currently supports [EasyOCR](https://github.com/JaidedAI/EasyOCR) (JaidedAI), [Tesseract](https://github.com/tesseract-ocr/tesseract) (Google), and [Pororo](https://github.com/kakaobrain/pororo) (KakaoBrain).

- For Pororo, we're using the code from https://github.com/black7375/korean_ocr_using_pororo <br />
  (Pre-processing ➡️ _Text detection_ with EasyOCR ➡️ _Text recognition_ with Pororo).
- Pororo is used only if the language options (`lang`) specified include either 🇺🇸 English (`en`) or 🇰🇷 Korean (`ko`). Also additional dependencies listed in <a href="https://github.com/junhoyeo/BetterOCR/blob/main/pyproject.toml#L22"><code>[tool.poetry.group.pororo.dependencies]</code></a> should be available. (If not, it'll automatically be excluded from enabled engines.)

### 🧠 LLM
Supports [Chat models](https://github.com/openai/openai-python#chat-completions) from OpenAI.

### 📒 Custom Context
Allows 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.

### 🛢️ Resources

- Head over to [💯 Examples](#-Examples) to view performace by languages (🇺🇸, 🇰🇷, 🇮🇳).
- Coming Soon: ~~box detection~~ 🧪✅, improved interface 🚧, async support, and more. Contributions are welcomed.

> **Warning**<br/>
> This package is under rapid development 🛠

<a href="https://github.com/junhoyeo">
  <img src="https://github.com/junhoyeo/BetterOCR/raw/main/.github/images/arch.jpg?v=2" width="100%" />
</a>

> Architecture

## 🚀 Usage (WIP)

```bash
pip install betterocr
# pip3 install betterocr
```

```py
import betterocr

# text detection
text = betterocr.detect_text(
    "demo.png",
    ["ko", "en"], # language codes (from EasyOCR)
    context="", # (optional) context
    tesseract={
      # Tesseract options here
      "config": "--tessdata-dir ./tessdata"
    },
    openai={
      # OpenAI options here

      # `os.environ["OPENAI_API_KEY"]` is used by default
      "API_KEY": "sk-xxxxxxx",

      # rest are used to pass params to `client.chat.completions.create`
      # `{"model": "gpt-4"}` by default
      "model": "gpt-3.5-turbo",
    },
)
print(text)
```

### 📦 Box Detection

| Original | Detected |
|:---:|:---:|
| <img src="https://github.com/junhoyeo/BetterOCR/raw/main/.github/images/demo-1.png" width="500px" /> | <img src="https://github.com/junhoyeo/BetterOCR/raw/main/.github/images/boxes-0.png" width="500px" /> |

Example Script: https://github.com/junhoyeo/BetterOCR/blob/main/examples/detect_boxes.py (Uses OpenCV and Matplotlib to draw rectangles)

```py
import betterocr

image_path = ".github/images/demo-1.png"
items = betterocr.detect_boxes(
    image_path,
    ["ko", "en"],
    context="퍼멘테이션 펩타인 아이케어 크림",  # product name
    tesseract={
        "config": "--psm 6 --tessdata-dir ./tessdata -c tessedit_create_boxfile=1"
    },
)
print(items)
```

<details>
  <summary>View Output</summary>

```py
[
  {'text': 'JUST FOR YOU', 'box': [[543, 87], [1013, 87], [1013, 151], [543, 151]]},
  {'text': '이런 분들께 추천드리는 퍼멘테이션 펩타인 아이케어 크림', 'box': [[240, 171], [1309, 171], [1309, 224], [240, 224]]},
  {'text': '매일매일 진해지는 다크서클을 개선하고 싶다면', 'box': [[123, 345], [1166, 345], [1166, 396], [123, 396]]},
  {'text': '축축 처지는 피부를 탄력 있게 바꾸고 싶다면', 'box': [[125, 409], [1242, 409], [1242, 470], [125, 470]]},
  {'text': '나날이 늘어가는 눈가 주름을 완화하고 싶다면', 'box': [[123, 479], [1112, 479], [1112, 553], [123, 553]]},
  {'text': 'FERMENATION', 'box': [[1216, 578], [1326, 578], [1326, 588], [1216, 588]]},
  {'text': '민감성 피부에도 사용할 수 있는 아이크림을 찾는다면', 'box': [[134, 534], [1071, 534], [1071, 618], [134, 618]]},
  {'text': '얇고 예민한 눈가 주변 피부를 관리하고 싶다면', 'box': [[173, 634], [1098, 634], [1098, 690], [173, 690]]}
]
```

</details>

## 💯 Examples

> **Note**<br/>
> Results may vary due to inherent variability and potential future updates to OCR engines or the OpenAI API.

### Example 1 (English with Noise)

<img src="https://github.com/junhoyeo/BetterOCR/raw/main/.github/images/demo-0.webp" width="500px" />

| Source | Text |
| ------ | ---- |
| EasyOCR | `CHAINSAWMANChapter 109:The Easy Way to Stop Bullying~BV-THTSUKIFUUIMUTU ETT` |
| 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` |
| Pororo | `CHAINSAWNAN\nChapter 109\nThe Easy Way.to Stop Bullying.\nCBY=TATSUKI FUJIMDTO` |
| LLM | 🤖 GPT-3.5 |
| **Result** | **`CHAINSAW MAN\n\nChapter 109: The Easy Way to Stop Bullying\n\nBY: TATSUKI FUJIMOTO`** |

### Example 2 (Korean+English)

<img src="https://github.com/junhoyeo/BetterOCR/raw/main/.github/images/demo-1.png" width="500px" />

| Source | Text |
| ------ | ---- |
| EasyOCR | `JUST FOR YOU이런 분들께 추천드리는 퍼멘테이선 팬타인 아이켜어 크림매일매일 진해지논 다크서클올 개선하고 싶다면축축 처지논 피부름 탄력 잇게 바꾸고 싶다면나날이 늘어가는 눈가 주름올 완화하고 싶다면FERMENATION민감성 피부에도 사용할 수잇는 아이크림올 찾는다면얇고 예민한 눈가 주변 피부름 관리하고 싶다면`                                                                              |
| Tesseract | `9051 508 \ㅇ4\n이런 분들께 추천드리는 퍼멘테이션 타인 아이케어 크림\n.매일매일 진해지는 다크서클을 개선하고 싶다면        "도\nㆍ축축 처지는 피부를 탄력 있게 바꾸고 싶다면         7\nㆍ나날이 늘어가는 눈가 주름을 완화하고 싶다면        /\n-민감성 피부에도 사용할 수 있는 아이크림을 찾는다면    (프\nㆍ않고 예민한 눈가 주변 피부를 관리하고 싶다면                         밸\n\n` |
| Pororo | `JUST FOR YOU\n이런 분들께 추천드리는 퍼맨테이션 펩타인 아이케어 크림\n매일매일 진해지는 다크서클을 개선하고 싶다면\n촉촉 처지는 피부를 탄력 있게 바꾸고 싶다면\n나날이 늘어가는 눈가 주름을 완화하고 싶다면\nFERMENTATIOM\n민감성 피부에도 사용할 수 있는 아이크림을 찾는다면\n얇고 예민한 눈가 주변 피부를 관리하고 싶다면` |
| LLM | 🤖 GPT-3.5 |
| **Result** | **`JUST FOR YOU\n이런 분들께 추천드리는 퍼멘테이션 펩타인 아이케어 크림\n매일매일 진해지는 다크서클을 개선하고 싶다면\n축축 처지는 피부를 탄력 있게 바꾸고 싶다면\n나날이 늘어가는 눈가 주름을 완화하고 싶다면\nFERMENTATION\n민감성 피부에도 사용할 수 있는 아이크림을 찾는다면\n얇고 예민한 눈가 주변 피부를 관리하고 싶다면`** |

### Example 3 (Korean with custom `context`)

<img src="https://github.com/junhoyeo/BetterOCR/raw/main/.github/images/demo-2.png" width="400px" />

| Source | Text |
| ------ | ---- |
| EasyOCR | `바이오함보#세로모공존존세럼6글로우픽 설문단 100인이꼼꼼하게 평가햇어요"#누적 판매액 40억#제품만족도 1009` |
| Tesseract | `바이오힐보\n#세로모공폰폰세럼\n“글로 으피 석무다 1 00인이\n꼼꼼하게평가했어요”\n\n` |
| Pororo | `바이오힐보\n#세로모공쫀쫀세럼\n'.\n'글로우픽 설문단 100인이\n꼼꼼하게 평가했어요'"\n#누적 판매액 40억\n# 제품 만족도 100%` |
| Context | `[바이오힐보] 세로모공쫀쫀세럼으로 콜라겐 타이트닝! (6S)` |
| LLM | 🤖 GPT-4 |
| **Result** | **`바이오힐보\n#세로모공쫀쫀세럼\n글로우픽 설문단 100인이 꼼꼼하게 평가했어요\n#누적 판매액 40억\n#제품 만족도 100%`** |

#### 🧠 LLM Reasoning (*Old)

Based on the given OCR results and the context, here is the combined and corrected result:

```
{
  "data": "바이오힐보\n#세로모공쫀쫀세럼\n글로우픽 설문단 100인이 꼼꼼하게 평가했어요\n#누적 판매액 40억\n#제품만족도 100%"
}
```

- `바이오힐보` is the correct brand name, taken from [1] and the context.
- `#세로모공쫀쫀세럼` seems to be the product name and is derived from the context.
- `글로우픽 설문단 100인이 꼼꼼하게 평가했어요` is extracted and corrected from both OCR results.
- `#누적 판매액 40억` is taken from [0].
- `#제품만족도 100%` is corrected from [0].

### Example 4 (Hindi)

<img src="https://github.com/junhoyeo/BetterOCR/raw/main/.github/images/demo-3.webp" width="500px" />

| Source | Text |
| ------ | ---- |
| EasyOCR | `` `७नवभारतटाइम्सतोक्यो ओलिंपिक के लिए भारतीय दलका थीम सॉन्ग लॉन्च कर दिया गयाबुधवार को इस सॉन्ग को किया गया लॉन्चसिंगर मोहित चौहान ने दी है आवाज7लखेल मंत्री किरण रिजिजू ने ट्विटर पर शेयरकिया थीम सॉन्ग का वीडियो0ब४0 २०२०गीत का नाम- '्लक्ष्य तेरा सामने है' , खेलमंत्री ने ५७ सेकंड का वीडियो किया शेयर `` |
| 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` |
| LLM | 🤖 GPT-4 |
| **Result** | **`नवभारत टाइम्स\nतोक्यो ओलिंपिक के लिए भारतीय दल का थीम सॉन्ग लॉन्च कर दिया गया\nबुधवार को इस सॉन्ग को किया गया लॉन्च\nसिंगर मोहित चौहान ने दी है आवाज\n\nखेल मंत्री किरण रिजिजू ने ट्विटर पर शेयर किया थीम सॉन्ग का वीडियो\n2020 गीत का नाम- 'लक्ष्य तेरा सामने है', खेल मंत्री ने 57 सेकंड का वीडियो किया शेयर`** |

## License (Starmie!)

<p align="center">
  <strong>MIT © <a href="https://github.com/junhoyeo">Junho Yeo</a></strong>
</p>

<p align="center">
  <a href="https://github.com/junhoyeo">
    <img src="https://github.com/junhoyeo/BetterOCR/raw/main/.github/images/starmie.jpg" width="256px" />
  </a>
</p>

If 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!

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "betterocr",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.11,<3.13",
    "maintainer_email": "",
    "keywords": "",
    "author": "Junho Yeo",
    "author_email": "i@junho.io",
    "download_url": "https://files.pythonhosted.org/packages/0d/8d/debf6be6cc7f16153eb03ab2cca8451c5bb3d7542347ffd56ed72b043da1/betterocr-1.2.0.tar.gz",
    "platform": null,
    "description": "<p align=\"center\">\n  <a href=\"https://github.com/junhoyeo\">\n    <img src=\"https://github.com/junhoyeo/BetterOCR/raw/main/.github/images/logo.png\" width=\"256px\" />\n  </a>\n</p>\n<h1 align=\"center\">BetterOCR</h1>\n\n<p align=\"center\">\n<a href=\"https://pypi.org/project/betterocr\"><img alt=\"PyPI\" src=\"https://img.shields.io/pypi/v/betterocr.svg?style=for-the-badge&labelColor=162246\" /></a>\n<a href=\"https://github.com/junhoyeo/betterocr/blob/main/LICENSE\"><img alt=\"MIT License\" src=\"https://img.shields.io/badge/license-MIT-blue?style=for-the-badge&labelColor=162246\" /></a>\n<p>\n\n> \ud83d\udd0d Better text detection by combining multiple OCR engines with \ud83e\udde0 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) \u2014 or just not thrilled with noisy results.\n\n**BetterOCR** combines results from multiple OCR engines with an LLM to correct & reconstruct the output.\n\n### \ud83d\udd0d 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 <br />\n  (Pre-processing \u27a1\ufe0f _Text detection_ with EasyOCR \u27a1\ufe0f _Text recognition_ with Pororo).\n- Pororo is used only if the language options (`lang`) specified include either \ud83c\uddfa\ud83c\uddf8 English (`en`) or \ud83c\uddf0\ud83c\uddf7 Korean (`ko`). Also additional dependencies listed in <a href=\"https://github.com/junhoyeo/BetterOCR/blob/main/pyproject.toml#L22\"><code>[tool.poetry.group.pororo.dependencies]</code></a> should be available. (If not, it'll automatically be excluded from enabled engines.)\n\n### \ud83e\udde0 LLM\nSupports [Chat models](https://github.com/openai/openai-python#chat-completions) from OpenAI.\n\n### \ud83d\udcd2 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### \ud83d\udee2\ufe0f Resources\n\n- Head over to [\ud83d\udcaf Examples](#-Examples) to view performace by languages (\ud83c\uddfa\ud83c\uddf8, \ud83c\uddf0\ud83c\uddf7, \ud83c\uddee\ud83c\uddf3).\n- Coming Soon: ~~box detection~~ \ud83e\uddea\u2705, improved interface \ud83d\udea7, async support, and more. Contributions are welcomed.\n\n> **Warning**<br/>\n> This package is under rapid development \ud83d\udee0\n\n<a href=\"https://github.com/junhoyeo\">\n  <img src=\"https://github.com/junhoyeo/BetterOCR/raw/main/.github/images/arch.jpg?v=2\" width=\"100%\" />\n</a>\n\n> Architecture\n\n## \ud83d\ude80 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### \ud83d\udce6 Box Detection\n\n| Original | Detected |\n|:---:|:---:|\n| <img src=\"https://github.com/junhoyeo/BetterOCR/raw/main/.github/images/demo-1.png\" width=\"500px\" /> | <img src=\"https://github.com/junhoyeo/BetterOCR/raw/main/.github/images/boxes-0.png\" width=\"500px\" /> |\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=\"\ud37c\uba58\ud14c\uc774\uc158 \ud3a9\ud0c0\uc778 \uc544\uc774\ucf00\uc5b4 \ud06c\ub9bc\",  # product name\n    tesseract={\n        \"config\": \"--psm 6 --tessdata-dir ./tessdata -c tessedit_create_boxfile=1\"\n    },\n)\nprint(items)\n```\n\n<details>\n  <summary>View Output</summary>\n\n```py\n[\n  {'text': 'JUST FOR YOU', 'box': [[543, 87], [1013, 87], [1013, 151], [543, 151]]},\n  {'text': '\uc774\ub7f0 \ubd84\ub4e4\uaed8 \ucd94\ucc9c\ub4dc\ub9ac\ub294 \ud37c\uba58\ud14c\uc774\uc158 \ud3a9\ud0c0\uc778 \uc544\uc774\ucf00\uc5b4 \ud06c\ub9bc', 'box': [[240, 171], [1309, 171], [1309, 224], [240, 224]]},\n  {'text': '\ub9e4\uc77c\ub9e4\uc77c \uc9c4\ud574\uc9c0\ub294 \ub2e4\ud06c\uc11c\ud074\uc744 \uac1c\uc120\ud558\uace0 \uc2f6\ub2e4\uba74', 'box': [[123, 345], [1166, 345], [1166, 396], [123, 396]]},\n  {'text': '\ucd95\ucd95 \ucc98\uc9c0\ub294 \ud53c\ubd80\ub97c \ud0c4\ub825 \uc788\uac8c \ubc14\uafb8\uace0 \uc2f6\ub2e4\uba74', 'box': [[125, 409], [1242, 409], [1242, 470], [125, 470]]},\n  {'text': '\ub098\ub0a0\uc774 \ub298\uc5b4\uac00\ub294 \ub208\uac00 \uc8fc\ub984\uc744 \uc644\ud654\ud558\uace0 \uc2f6\ub2e4\uba74', 'box': [[123, 479], [1112, 479], [1112, 553], [123, 553]]},\n  {'text': 'FERMENATION', 'box': [[1216, 578], [1326, 578], [1326, 588], [1216, 588]]},\n  {'text': '\ubbfc\uac10\uc131 \ud53c\ubd80\uc5d0\ub3c4 \uc0ac\uc6a9\ud560 \uc218 \uc788\ub294 \uc544\uc774\ud06c\ub9bc\uc744 \ucc3e\ub294\ub2e4\uba74', 'box': [[134, 534], [1071, 534], [1071, 618], [134, 618]]},\n  {'text': '\uc587\uace0 \uc608\ubbfc\ud55c \ub208\uac00 \uc8fc\ubcc0 \ud53c\ubd80\ub97c \uad00\ub9ac\ud558\uace0 \uc2f6\ub2e4\uba74', 'box': [[173, 634], [1098, 634], [1098, 690], [173, 690]]}\n]\n```\n\n</details>\n\n## \ud83d\udcaf Examples\n\n> **Note**<br/>\n> 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<img src=\"https://github.com/junhoyeo/BetterOCR/raw/main/.github/images/demo-0.webp\" width=\"500px\" />\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 \u2014\u2014 \u201cs 7 \u201cA\\n=) 24 4 = rt fl /1\\n\u00a372 7 a NS dA Chapter 109:77/ \u00a2 4\\nZz % = ~ oes os \\| \\STheEasf Way.to Stop Bullying:\\n\u00a9 Wa) ROT\\n\\n` |\n| Pororo | `CHAINSAWNAN\\nChapter 109\\nThe Easy Way.to Stop Bullying.\\nCBY=TATSUKI FUJIMDTO` |\n| LLM | \ud83e\udd16 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<img src=\"https://github.com/junhoyeo/BetterOCR/raw/main/.github/images/demo-1.png\" width=\"500px\" />\n\n| Source | Text |\n| ------ | ---- |\n| EasyOCR | `JUST FOR YOU\uc774\ub7f0 \ubd84\ub4e4\uaed8 \ucd94\ucc9c\ub4dc\ub9ac\ub294 \ud37c\uba58\ud14c\uc774\uc120 \ud32c\ud0c0\uc778 \uc544\uc774\ucf1c\uc5b4 \ud06c\ub9bc\ub9e4\uc77c\ub9e4\uc77c \uc9c4\ud574\uc9c0\ub17c \ub2e4\ud06c\uc11c\ud074\uc62c \uac1c\uc120\ud558\uace0 \uc2f6\ub2e4\uba74\ucd95\ucd95 \ucc98\uc9c0\ub17c \ud53c\ubd80\ub984 \ud0c4\ub825 \uc787\uac8c \ubc14\uafb8\uace0 \uc2f6\ub2e4\uba74\ub098\ub0a0\uc774 \ub298\uc5b4\uac00\ub294 \ub208\uac00 \uc8fc\ub984\uc62c \uc644\ud654\ud558\uace0 \uc2f6\ub2e4\uba74FERMENATION\ubbfc\uac10\uc131 \ud53c\ubd80\uc5d0\ub3c4 \uc0ac\uc6a9\ud560 \uc218\uc787\ub294 \uc544\uc774\ud06c\ub9bc\uc62c \ucc3e\ub294\ub2e4\uba74\uc587\uace0 \uc608\ubbfc\ud55c \ub208\uac00 \uc8fc\ubcc0 \ud53c\ubd80\ub984 \uad00\ub9ac\ud558\uace0 \uc2f6\ub2e4\uba74`                                                                              |\n| Tesseract | `9051 508 \\\u31474\\n\uc774\ub7f0 \ubd84\ub4e4\uaed8 \ucd94\ucc9c\ub4dc\ub9ac\ub294 \ud37c\uba58\ud14c\uc774\uc158 \ud0c0\uc778 \uc544\uc774\ucf00\uc5b4 \ud06c\ub9bc\\n.\ub9e4\uc77c\ub9e4\uc77c \uc9c4\ud574\uc9c0\ub294 \ub2e4\ud06c\uc11c\ud074\uc744 \uac1c\uc120\ud558\uace0 \uc2f6\ub2e4\uba74        \"\ub3c4\\n\u318d\ucd95\ucd95 \ucc98\uc9c0\ub294 \ud53c\ubd80\ub97c \ud0c4\ub825 \uc788\uac8c \ubc14\uafb8\uace0 \uc2f6\ub2e4\uba74         7\\n\u318d\ub098\ub0a0\uc774 \ub298\uc5b4\uac00\ub294 \ub208\uac00 \uc8fc\ub984\uc744 \uc644\ud654\ud558\uace0 \uc2f6\ub2e4\uba74        /\\n-\ubbfc\uac10\uc131 \ud53c\ubd80\uc5d0\ub3c4 \uc0ac\uc6a9\ud560 \uc218 \uc788\ub294 \uc544\uc774\ud06c\ub9bc\uc744 \ucc3e\ub294\ub2e4\uba74    (\ud504\\n\u318d\uc54a\uace0 \uc608\ubbfc\ud55c \ub208\uac00 \uc8fc\ubcc0 \ud53c\ubd80\ub97c \uad00\ub9ac\ud558\uace0 \uc2f6\ub2e4\uba74                         \ubc38\\n\\n` |\n| Pororo | `JUST FOR YOU\\n\uc774\ub7f0 \ubd84\ub4e4\uaed8 \ucd94\ucc9c\ub4dc\ub9ac\ub294 \ud37c\ub9e8\ud14c\uc774\uc158 \ud3a9\ud0c0\uc778 \uc544\uc774\ucf00\uc5b4 \ud06c\ub9bc\\n\ub9e4\uc77c\ub9e4\uc77c \uc9c4\ud574\uc9c0\ub294 \ub2e4\ud06c\uc11c\ud074\uc744 \uac1c\uc120\ud558\uace0 \uc2f6\ub2e4\uba74\\n\ucd09\ucd09 \ucc98\uc9c0\ub294 \ud53c\ubd80\ub97c \ud0c4\ub825 \uc788\uac8c \ubc14\uafb8\uace0 \uc2f6\ub2e4\uba74\\n\ub098\ub0a0\uc774 \ub298\uc5b4\uac00\ub294 \ub208\uac00 \uc8fc\ub984\uc744 \uc644\ud654\ud558\uace0 \uc2f6\ub2e4\uba74\\nFERMENTATIOM\\n\ubbfc\uac10\uc131 \ud53c\ubd80\uc5d0\ub3c4 \uc0ac\uc6a9\ud560 \uc218 \uc788\ub294 \uc544\uc774\ud06c\ub9bc\uc744 \ucc3e\ub294\ub2e4\uba74\\n\uc587\uace0 \uc608\ubbfc\ud55c \ub208\uac00 \uc8fc\ubcc0 \ud53c\ubd80\ub97c \uad00\ub9ac\ud558\uace0 \uc2f6\ub2e4\uba74` |\n| LLM | \ud83e\udd16 GPT-3.5 |\n| **Result** | **`JUST FOR YOU\\n\uc774\ub7f0 \ubd84\ub4e4\uaed8 \ucd94\ucc9c\ub4dc\ub9ac\ub294 \ud37c\uba58\ud14c\uc774\uc158 \ud3a9\ud0c0\uc778 \uc544\uc774\ucf00\uc5b4 \ud06c\ub9bc\\n\ub9e4\uc77c\ub9e4\uc77c \uc9c4\ud574\uc9c0\ub294 \ub2e4\ud06c\uc11c\ud074\uc744 \uac1c\uc120\ud558\uace0 \uc2f6\ub2e4\uba74\\n\ucd95\ucd95 \ucc98\uc9c0\ub294 \ud53c\ubd80\ub97c \ud0c4\ub825 \uc788\uac8c \ubc14\uafb8\uace0 \uc2f6\ub2e4\uba74\\n\ub098\ub0a0\uc774 \ub298\uc5b4\uac00\ub294 \ub208\uac00 \uc8fc\ub984\uc744 \uc644\ud654\ud558\uace0 \uc2f6\ub2e4\uba74\\nFERMENTATION\\n\ubbfc\uac10\uc131 \ud53c\ubd80\uc5d0\ub3c4 \uc0ac\uc6a9\ud560 \uc218 \uc788\ub294 \uc544\uc774\ud06c\ub9bc\uc744 \ucc3e\ub294\ub2e4\uba74\\n\uc587\uace0 \uc608\ubbfc\ud55c \ub208\uac00 \uc8fc\ubcc0 \ud53c\ubd80\ub97c \uad00\ub9ac\ud558\uace0 \uc2f6\ub2e4\uba74`** |\n\n### Example 3 (Korean with custom `context`)\n\n<img src=\"https://github.com/junhoyeo/BetterOCR/raw/main/.github/images/demo-2.png\" width=\"400px\" />\n\n| Source | Text |\n| ------ | ---- |\n| EasyOCR | `\ubc14\uc774\uc624\ud568\ubcf4#\uc138\ub85c\ubaa8\uacf5\uc874\uc874\uc138\ub7fc6\uae00\ub85c\uc6b0\ud53d \uc124\ubb38\ub2e8 100\uc778\uc774\uaf3c\uaf3c\ud558\uac8c \ud3c9\uac00\ud587\uc5b4\uc694\"#\ub204\uc801 \ud310\ub9e4\uc561 40\uc5b5#\uc81c\ud488\ub9cc\uc871\ub3c4 1009` |\n| Tesseract | `\ubc14\uc774\uc624\ud790\ubcf4\\n#\uc138\ub85c\ubaa8\uacf5\ud3f0\ud3f0\uc138\ub7fc\\n\u201c\uae00\ub85c \uc73c\ud53c \uc11d\ubb34\ub2e4 1 00\uc778\uc774\\n\uaf3c\uaf3c\ud558\uac8c\ud3c9\uac00\ud588\uc5b4\uc694\u201d\\n\\n` |\n| Pororo | `\ubc14\uc774\uc624\ud790\ubcf4\\n#\uc138\ub85c\ubaa8\uacf5\ucac0\ucac0\uc138\ub7fc\\n'.\\n'\uae00\ub85c\uc6b0\ud53d \uc124\ubb38\ub2e8 100\uc778\uc774\\n\uaf3c\uaf3c\ud558\uac8c \ud3c9\uac00\ud588\uc5b4\uc694'\"\\n#\ub204\uc801 \ud310\ub9e4\uc561 40\uc5b5\\n# \uc81c\ud488 \ub9cc\uc871\ub3c4 100%` |\n| Context | `[\ubc14\uc774\uc624\ud790\ubcf4] \uc138\ub85c\ubaa8\uacf5\ucac0\ucac0\uc138\ub7fc\uc73c\ub85c \ucf5c\ub77c\uac90 \ud0c0\uc774\ud2b8\ub2dd! (6S)` |\n| LLM | \ud83e\udd16 GPT-4 |\n| **Result** | **`\ubc14\uc774\uc624\ud790\ubcf4\\n#\uc138\ub85c\ubaa8\uacf5\ucac0\ucac0\uc138\ub7fc\\n\uae00\ub85c\uc6b0\ud53d \uc124\ubb38\ub2e8 100\uc778\uc774 \uaf3c\uaf3c\ud558\uac8c \ud3c9\uac00\ud588\uc5b4\uc694\\n#\ub204\uc801 \ud310\ub9e4\uc561 40\uc5b5\\n#\uc81c\ud488 \ub9cc\uc871\ub3c4 100%`** |\n\n#### \ud83e\udde0 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\": \"\ubc14\uc774\uc624\ud790\ubcf4\\n#\uc138\ub85c\ubaa8\uacf5\ucac0\ucac0\uc138\ub7fc\\n\uae00\ub85c\uc6b0\ud53d \uc124\ubb38\ub2e8 100\uc778\uc774 \uaf3c\uaf3c\ud558\uac8c \ud3c9\uac00\ud588\uc5b4\uc694\\n#\ub204\uc801 \ud310\ub9e4\uc561 40\uc5b5\\n#\uc81c\ud488\ub9cc\uc871\ub3c4 100%\"\n}\n```\n\n- `\ubc14\uc774\uc624\ud790\ubcf4` is the correct brand name, taken from [1] and the context.\n- `#\uc138\ub85c\ubaa8\uacf5\ucac0\ucac0\uc138\ub7fc` seems to be the product name and is derived from the context.\n- `\uae00\ub85c\uc6b0\ud53d \uc124\ubb38\ub2e8 100\uc778\uc774 \uaf3c\uaf3c\ud558\uac8c \ud3c9\uac00\ud588\uc5b4\uc694` is extracted and corrected from both OCR results.\n- `#\ub204\uc801 \ud310\ub9e4\uc561 40\uc5b5` is taken from [0].\n- `#\uc81c\ud488\ub9cc\uc871\ub3c4 100%` is corrected from [0].\n\n### Example 4 (Hindi)\n\n<img src=\"https://github.com/junhoyeo/BetterOCR/raw/main/.github/images/demo-3.webp\" width=\"500px\" />\n\n| Source | Text |\n| ------ | ---- |\n| EasyOCR | `` `\u096d\u0928\u0935\u092d\u093e\u0930\u0924\u091f\u093e\u0907\u092e\u094d\u0938\u0924\u094b\u0915\u094d\u092f\u094b \u0913\u0932\u093f\u0902\u092a\u093f\u0915 \u0915\u0947 \u0932\u093f\u090f \u092d\u093e\u0930\u0924\u0940\u092f \u0926\u0932\u0915\u093e \u0925\u0940\u092e \u0938\u0949\u0928\u094d\u0917 \u0932\u0949\u0928\u094d\u091a \u0915\u0930 \u0926\u093f\u092f\u093e \u0917\u092f\u093e\u092c\u0941\u0927\u0935\u093e\u0930 \u0915\u094b \u0907\u0938 \u0938\u0949\u0928\u094d\u0917 \u0915\u094b \u0915\u093f\u092f\u093e \u0917\u092f\u093e \u0932\u0949\u0928\u094d\u091a\u0938\u093f\u0902\u0917\u0930 \u092e\u094b\u0939\u093f\u0924 \u091a\u094c\u0939\u093e\u0928 \u0928\u0947 \u0926\u0940 \u0939\u0948 \u0906\u0935\u093e\u091c7\u0932\u0916\u0947\u0932 \u092e\u0902\u0924\u094d\u0930\u0940 \u0915\u093f\u0930\u0923 \u0930\u093f\u091c\u093f\u091c\u0942 \u0928\u0947 \u091f\u094d\u0935\u093f\u091f\u0930 \u092a\u0930 \u0936\u0947\u092f\u0930\u0915\u093f\u092f\u093e \u0925\u0940\u092e \u0938\u0949\u0928\u094d\u0917 \u0915\u093e \u0935\u0940\u0921\u093f\u092f\u094b0\u092c\u096a0 \u0968\u0966\u0968\u0966\u0917\u0940\u0924 \u0915\u093e \u0928\u093e\u092e- '\u094d\u0932\u0915\u094d\u0937\u094d\u092f \u0924\u0947\u0930\u093e \u0938\u093e\u092e\u0928\u0947 \u0939\u0948' , \u0916\u0947\u0932\u092e\u0902\u0924\u094d\u0930\u0940 \u0928\u0947 \u096b\u096d \u0938\u0947\u0915\u0902\u0921 \u0915\u093e \u0935\u0940\u0921\u093f\u092f\u094b \u0915\u093f\u092f\u093e \u0936\u0947\u092f\u0930 `` |\n| Tesseract | `'8\u093e.\\n\u0928\u0935\u092d\u094b\u0930\u0924 \u091f\u0948\u0907\u092e\u094d\u0938\\n\\n\u0924\u094b\u0915\u094d\u092f\u094b \u0913\u0932\u093f\u0902\u092a\u093f\u0915 \u0915\u0947 \u0932\u093f\u0902\u090f \u092d\u093e\u0930\u0924\u0940\u092f \u0926\u0932\\n\\n\u0915\u093e \u0925\u0940\u092e \u0938\u0949\u0928\u094d\u0917 \u0932\u0949\u0928\u094d\u091a \u0915\u0930 \u0926\u093f\u092f\u093e \u0917\u092f\u093e\\n\\n\u092c\u0941\u0927\u0935\u093e\u0930 \u0915\u094b \u0939\u0938 \u0938\u0949\u0928\u094d\u0917 \u0915\u094b \u0915\u093f\u092f\u093e \u0917\u092f\u093e \u0932\u0949\u0928\u094d\u091a\\n\u0938\u093f\u0902\u0917\u0930 \u092e\u094b\u0939\u093f\u0924 \u091a\u094c\u0939\u093e\u0928 \u0928\u0947 \u0926\u0940 \u0939\u0948 \u0906\u0935\u093e\u091c\\n\\n\u0916\u0947\u0932 \u092e\u0902\u0924\u094d\u0930\u0940 \u0915\u093f\u0930\u0923 \u0930\u093f\u091c\u093f\u091c\u0942 \u0928\u0947 \u0926\u094d\u0935\u093f\u091f\u0930 \u092a\u0930 \u0936\u0947\u092f\u0930\\n\u0915\u093f\u092f\u093e \u0925\u0940\u092e \u0938\u0949\u0928\u094d\u0917 \u0915\u093e \u0935\u0940\u0921\u093f\u092f\u094b\\n\\n\u092a\u0943 0 (\u096f \u0939\u0948 0 2 0 2 0 \u0917\u0940\u0924 \u0915\u093e \u0928\u093e\u092e- '\u0932\u0915\u094d\u0937\u094d\u092f \u0924\u0947\u0930\u093e \u0938\u093e\u092e\u0928\u0947 \u0939\u0948', \u0916\u0947\u0932\\n\\n(2 (9\u096f) \u092e\u0902\u0924\u094d\u0930\u0940 \u0928\u0947 57 \u0938\u0947\u0915\u0902\u0921 \u0915\u093e \u0935\u0940\u0921\u093f\u092f\u094b \u0915\u093f\u092f\u093e \u0936\u0947\u092f\u0930\\n\\n` |\n| LLM | \ud83e\udd16 GPT-4 |\n| **Result** | **`\u0928\u0935\u092d\u093e\u0930\u0924 \u091f\u093e\u0907\u092e\u094d\u0938\\n\u0924\u094b\u0915\u094d\u092f\u094b \u0913\u0932\u093f\u0902\u092a\u093f\u0915 \u0915\u0947 \u0932\u093f\u090f \u092d\u093e\u0930\u0924\u0940\u092f \u0926\u0932 \u0915\u093e \u0925\u0940\u092e \u0938\u0949\u0928\u094d\u0917 \u0932\u0949\u0928\u094d\u091a \u0915\u0930 \u0926\u093f\u092f\u093e \u0917\u092f\u093e\\n\u092c\u0941\u0927\u0935\u093e\u0930 \u0915\u094b \u0907\u0938 \u0938\u0949\u0928\u094d\u0917 \u0915\u094b \u0915\u093f\u092f\u093e \u0917\u092f\u093e \u0932\u0949\u0928\u094d\u091a\\n\u0938\u093f\u0902\u0917\u0930 \u092e\u094b\u0939\u093f\u0924 \u091a\u094c\u0939\u093e\u0928 \u0928\u0947 \u0926\u0940 \u0939\u0948 \u0906\u0935\u093e\u091c\\n\\n\u0916\u0947\u0932 \u092e\u0902\u0924\u094d\u0930\u0940 \u0915\u093f\u0930\u0923 \u0930\u093f\u091c\u093f\u091c\u0942 \u0928\u0947 \u091f\u094d\u0935\u093f\u091f\u0930 \u092a\u0930 \u0936\u0947\u092f\u0930 \u0915\u093f\u092f\u093e \u0925\u0940\u092e \u0938\u0949\u0928\u094d\u0917 \u0915\u093e \u0935\u0940\u0921\u093f\u092f\u094b\\n2020 \u0917\u0940\u0924 \u0915\u093e \u0928\u093e\u092e- '\u0932\u0915\u094d\u0937\u094d\u092f \u0924\u0947\u0930\u093e \u0938\u093e\u092e\u0928\u0947 \u0939\u0948', \u0916\u0947\u0932 \u092e\u0902\u0924\u094d\u0930\u0940 \u0928\u0947 57 \u0938\u0947\u0915\u0902\u0921 \u0915\u093e \u0935\u0940\u0921\u093f\u092f\u094b \u0915\u093f\u092f\u093e \u0936\u0947\u092f\u0930`** |\n\n## License (Starmie!)\n\n<p align=\"center\">\n  <strong>MIT \u00a9 <a href=\"https://github.com/junhoyeo\">Junho Yeo</a></strong>\n</p>\n\n<p align=\"center\">\n  <a href=\"https://github.com/junhoyeo\">\n    <img src=\"https://github.com/junhoyeo/BetterOCR/raw/main/.github/images/starmie.jpg\" width=\"256px\" />\n  </a>\n</p>\n\nIf you find this project interesting, **please consider giving it a star(\u2b50)** 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",
    "bugtrack_url": null,
    "license": "",
    "summary": "Better text detection by combining OCR engines with LLM.",
    "version": "1.2.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "95e846604109c7db262a387175aa06f1d583c461a03737e4b58ac5b97884fdb2",
                "md5": "e90264dac28f84f50b54a1f9afd18e31",
                "sha256": "f0368fd6399bfe0a925b89d6500fffe17090dccbe44a479570438ca2796c5c6b"
            },
            "downloads": -1,
            "filename": "betterocr-1.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e90264dac28f84f50b54a1f9afd18e31",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11,<3.13",
            "size": 64609,
            "upload_time": "2023-11-02T01:19:03",
            "upload_time_iso_8601": "2023-11-02T01:19:03.639970Z",
            "url": "https://files.pythonhosted.org/packages/95/e8/46604109c7db262a387175aa06f1d583c461a03737e4b58ac5b97884fdb2/betterocr-1.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0d8ddebf6be6cc7f16153eb03ab2cca8451c5bb3d7542347ffd56ed72b043da1",
                "md5": "330a76c8d684bbebfe670a2ab07fa126",
                "sha256": "5d193d420092424539727ef2de04181a9ff9ab935dce3053d211f00365d86d46"
            },
            "downloads": -1,
            "filename": "betterocr-1.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "330a76c8d684bbebfe670a2ab07fa126",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11,<3.13",
            "size": 52968,
            "upload_time": "2023-11-02T01:19:05",
            "upload_time_iso_8601": "2023-11-02T01:19:05.948441Z",
            "url": "https://files.pythonhosted.org/packages/0d/8d/debf6be6cc7f16153eb03ab2cca8451c5bb3d7542347ffd56ed72b043da1/betterocr-1.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-02 01:19:05",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "betterocr"
}
        
Elapsed time: 1.28502s