Skip to main content

Filter OCR text from prescriptions to extract drug-related texts

Project description

RxBagExtractor

RxBagExtractor 약봉투 사진을 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: OCR 텍스트의 각 줄에 이 정규표현식이 포함되어 있으면 해당 줄을 삭제합니다. 기본적으로 설정된 정규표현식 외에 추가적으로 필터링하고 싶은 정규표현식이 있을시 사용합니다. 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.6.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

RxBagExtractor-0.1.6-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file RxBagExtractor-0.1.6.tar.gz.

File metadata

  • Download URL: RxBagExtractor-0.1.6.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.4

File hashes

Hashes for RxBagExtractor-0.1.6.tar.gz
Algorithm Hash digest
SHA256 653863ae8954959b6f7d6dd2d776dba498cd4625cfdfe85c8030bfdbc1140eb5
MD5 1dedf0d24ee305c2bb464f29583e95d4
BLAKE2b-256 044dc7bd9ccfed29efd82a7c37ba2f1e3c5f0a77c531ae0fb9c92a351f28edaa

See more details on using hashes here.

File details

Details for the file RxBagExtractor-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: RxBagExtractor-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.4

File hashes

Hashes for RxBagExtractor-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 6a44859c237b48a7f7df639bd977290ebc9fea65935c16c169f8dd0683e2c3ee
MD5 ced97274b3f0e0dc404c4ef8d1a01cad
BLAKE2b-256 091b7a06613564f70710625ac37f8befb13a274586ae854a1e04321aed5a5d07

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page