Kiwi Rs Assistant
Use this skill to produce runnable, minimal, and correct kiwi-rs solutions.
Workflow
- •Identify intent first.
- •Map the request to one primary task:
tokenize,analyze,split,join/space/glue, builder customization, typo correction, UTF-16 path, batch processing, or semantics APIs. - •Prefer the smallest API surface that satisfies the request.
- •Choose initialization path deliberately.
- •Use
Kiwi::init()for the easiest path with automatic bootstrap. - •Use
Kiwi::new()whenKIWI_LIBRARY_PATHandKIWI_MODEL_PATHare already managed by environment. - •Use
Kiwi::from_config(KiwiConfig::default()...)when explicit, reproducible paths are required. - •Use
KiwiLibrary+builder(...)when adding user words, regex rules, dictionaries, or typo sets before buildingKiwi.
- •Generate runnable Rust code.
- •Return complete snippets that compile (
fn main() -> Result<(), Box<dyn std::error::Error>>). - •Import only required items from
kiwi_rs. - •Keep text examples Korean unless the user requests otherwise.
- •If the user asks for many features, stage the answer as a minimal baseline plus one extension block.
- •Add one validation step.
- •Provide at least one command that confirms behavior (
cargo run --example ...orcargo runfor the snippet project). - •Include expected high-level output shape (for example: token count, candidate count, sentence boundaries).
- •Add focused troubleshooting guidance.
- •Map failure messages to concrete fixes using
references/troubleshooting.md. - •If bootstrap is used, mention required external commands:
curl,tar(andpowershellon Windows).
Accuracy Guardrails
- •Treat UTF-8 offsets as character indices (
str.chars()), not byte indices. - •Check
supports_utf16_api()before UTF-16 tokenization/sentence APIs. - •Check
supports_analyze_mw()beforeanalyze_many_utf16_via_native. - •Do not claim full
kiwipiepyparity. Call out missing or partial areas (for exampleTemplate,Stopwords, and other Python/C++-specific layers). - •For deterministic spans or constraints, prefer
MorphemeSetandPretokenized. - •When discussing custom vocabulary or typo behavior, configure it in builder phase and rebuild
Kiwi.
Response Contract
Always structure answers in this order:
- •
Path: chosen initialization and why. - •
Code: copy-paste runnable snippet. - •
Verify: one concrete command. - •
Pitfalls: only the risks relevant to the user request.
References
- •Read
references/task-to-api.mdto map user goals to APIs and local examples. - •Read
references/troubleshooting.mdwhen errors, environment issues, or parity confusion appear.