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.1-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: korean_glue-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9cd0b72f2a0c0ab95f4b1c22c8b969857426f00d910283b8b8656bb9a3da29f7
MD5 07bae635ee2167b007aeaf455567b08f
BLAKE2b-256 76a60c1929484dc3673ec0b72dba1ef270514a8c06df6ee9d621b518efac1399

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