Filter OCR text from prescriptions to extract drug-related texts
Project description
RxBagExtractor
RxBagExtractor 약봉투 사진을 OCR로 읽은 뒤, 해당 텍스트에서 약물명 관련 텍스트를 추출하는 파이썬 라이브러리입니다. 한글로 작성된 처방전 텍스트 처리에 최적화되어 있습니다.
Features
- 텍스트 필터링: OCR로 읽은 텍스트에서 사용자가 지정한 정규 표현식에 따라 불필요한 텍스트를 제거합니다.
- 약물 이름 추출: 주어진 텍스트에서 약물 이름만을 추출하는 기능을 제공합니다.
Installation
pip install RxBagExtractor
Usage
Required Parameter
ocr_text: OCR로 읽은 후 얻은 텍스트로, 각 줄이 엔터로 구분된 긴 문자열입니다.
Optional Parameters
stopwords_customize: 기본 불용어 리스트 외에 추가적으로 필터링하고 싶은 단어들을 문자열 리스트로 입력할 수 있습니다.patterns_exact_customize: OCR 텍스트의 각 줄에서 정확히 매치되어야 할 정규 표현식을 포함하는 리스트. 각 항목은re.compile(r"정규표현식")형식으로 입력됩니다.patterns_include_customize: - CR 텍스트의 각 줄에 이 정규표현식이 포함되어 있으면 해당 줄을 삭제합니다.re.compile(r"정규표현식")형식으로 입력됩니다.
Example
from RxBagExtractor import extractor
# 약봉투 사진에 대한 OCR 결과 텍스트
ocr_text = "여기에 OCR로 읽은 텍스트 입력"
# Parameter 정의
stopwords_customize = ['유아용', '방문시']
patterns_exact_customize = [re.compile(r"^\d{4}-\d{2}-\d{2}$")]
patterns_include_customize = [re.compile(r"^\d+-\d+-\d+$")]
# 함수 실행
result = extractor(ocr_text, stopwords_customize, patterns_exact_customize, patterns_include_customize)
print(result)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
RxBagExtractor-0.1.4.tar.gz
(5.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file RxBagExtractor-0.1.4.tar.gz.
File metadata
- Download URL: RxBagExtractor-0.1.4.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1024a48a1498371851c5912a5b884f48d59acc43f57b18ad57d3a6cd0d6ac5fa
|
|
| MD5 |
3486b41a8492feae0140810c4415cdc9
|
|
| BLAKE2b-256 |
16dab2228713a7cea13b1ae90141d12510a49a5c9d036b81dcd015b7c1f3588f
|
File details
Details for the file RxBagExtractor-0.1.4-py3-none-any.whl.
File metadata
- Download URL: RxBagExtractor-0.1.4-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8254e06b313894d7126511e6d3f6fdfc9be5b0a05cae4a8b1209dacbae9648b6
|
|
| MD5 |
b77cd7487726580ea49afc4ecaa99c4a
|
|
| BLAKE2b-256 |
b6535e24360934116531c9aefdf00ea8f416c5d536612ca7bfc522770c1dabb4
|