Skip to main content

A modern Python library for Korean josa processing with dictionary support and framework integrations.

Project description

한국어

korean_glue

CI Python License

A modern Python library for Korean josa processing combining rule-based and dictionary-based approaches. Django template tags and Jinja2 filters are included for easy web framework integration.

Installation

pip install korean_glue

Framework integrations rely on Django and Jinja2.

Usage

Basic API

from korean_glue import attach, get_josa

print(get_josa("사과", "은/는"))  # "는"
print(attach("사과", "은/는"))    # "사과는"

Custom Exception Rules

from korean_glue import add_exception_rule, remove_exception_rule, attach

add_exception_rule("사과", "은/는", "당")
print(attach("사과", "은/는"))  # "사과당"
remove_exception_rule("사과", "은/는")

Command Line

Install the package and run the kglue command:

kglue '철수(은/는)'
kglue 'K(이/가)'
kglue '3(을/를)'

Framework Integrations

Django

{{ variable|josa:"을/를" }}

Jinja2

from korean_glue.integrations import jinja_filters
from jinja2 import Environment

env = Environment()
jinja_filters.register(env)
result = env.from_string("{{ word|josa('으로/로') }}").render(word="서울")

Running Tests

After setting up a development environment (see CONTRIBUTING.md), run:

pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

korean_glue-0.1.2-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file korean_glue-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: korean_glue-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for korean_glue-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 26107c2f28f9b9efd3d7fb5161133f79f334a79a7845a2492e816224886db1a4
MD5 8233e1237b5c8507f91244415d47dceb
BLAKE2b-256 22c5e04b4e5d389efc4a39cf3350678d0a022e0e6a4afbdcd69af917757d449d

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