madi (마디)
순수 Rust 한국어 형태소 분석기 madi 의 라이브러리 진입점. 세종 품사 태그(NNG, VV, EF …)로 형태소를 나누고, 형태소 분석을 이용한 문장 분리도 합니다. Python 패키지는 pip install madipy(import madi).
A Korean morphological analyzer written in pure Rust (Sejong tag set, morpheme-aware sentence splitting). This crate is the library entry point (Engine); the command-line tool is madi-cli, the Python package is madipy.
사용 / Usage
[]
= "0.2" # 신경망 LM 포함 (feature nlm)
# madi = { version = "0.2", default-features = false } # KnLM 만 (가벼운 모드)
let cfg = EngineConfig ;
let engine = load?; // Send + Sync — 스레드마다 worker() 하나
println!; // 0.2.1+decdb.r3p.f11.k838c.n15e6.s- (모델·설정 확인용)
let mut w = engine.worker;
for s in w.sentences
어느 함수를 쓸지(문장 하나 analyze_sentence, 여러 후보 analyze_nbest, 구간 지정 analyze_pretokenized, 문서 정제 analyze_doc)와
각 결과 구조체의 뜻은 docs.rs 의 크레이트 문서에 표로 정리돼 있습니다: https://docs.rs/madi
let mut w = engine.worker;
let toks = w.analyze_sentence; // Vec<madi::Token>
println!; // 아버지/NNG 가/JKS | 방/NNG 에/JKB | …
for in w.analyze_nbest
let = w.analyze_pretokenized;
engine.add_user_word; // &mut Engine — 다음 worker 부터, 판본 문자열에 .u
Tag::code()(NNG) · Tag::ko()(일반명) · Tag::name()(일반명사) · Tag::from_any("일반명"), 원형은 madi::lemma(&token).
모델 파일(madi.dict·knlm.bin·model.nlm·precise.tlm)은 크레이트에 들어 있지 않습니다. GitHub Release 에서 받습니다:
https://github.com/p14jeffwest/madi-release/releases (Python 패키지는 처음 쓸 때 자동으로 받습니다.)
Model files are not in the crate; download them from the release repository above.
이용 조건 / License
코드는 MIT 또는 Apache-2.0 중 택일입니다(저장소의 LICENSE-MIT·LICENSE-APACHE). 모델·사전 파일은 따로 배포하며 CC BY-SA 2.0 KR 입니다 — https://github.com/p14jeffwest/madi-release
Code: MIT OR Apache-2.0. Model files are distributed separately (CC BY-SA 2.0 KR), see the release repository above.