kiwipiepy Model

0.23.0 · active · verified Fri Apr 17

kiwipiepy-model provides the language models necessary for kiwipiepy, a fast and accurate Korean morphological analyzer. It is a data-only package, implicitly installed as a dependency when you install kiwipiepy. The current version is 0.23.0, and it generally updates in lockstep with major versions of the core kiwipiepy library to provide the latest model improvements.

Common errors

Warnings

Install

Imports

Quickstart

Initialize the Kiwi morphological analyzer. The default model is automatically loaded from the kiwipiepy-model package. This example demonstrates basic tokenization and sentence splitting, incorporating the new `oov_handling` parameter.

from kiwipiepy import Kiwi

# Initialize Kiwi with default model (loaded from kiwipiepy-model)
kiwi = Kiwi(oov_handling='ngram') # Example with new oov_handling

text = "안녕하세요, 저는 키위입니다."
tokens = kiwi.tokenize(text)
for token in tokens:
    print(f"Word: {token.form}, Tag: {token.tag}, Start: {token.start}, End: {token.end}")

sentences = kiwi.split_into_sentences("어제는 비가 왔어요. 오늘은 맑을 예정입니다.")
for sentence in sentences:
    print(f"Sentence: {sentence.text}")
    for token in sentence.tokens:
        print(f"  {token.form}/{token.tag}")

view raw JSON →