A pure-MoonBit Hunspell-compatible spelling engine
Dependencies
parse_aff(text) -> Result[AffixConfig, AffixParseError]
parse_dic(text) -> Result[Dictionary, DicParseError]
spell(dictionary, config, word) -> SpellResult
suggest(dictionary, config, word, limit) -> Array[Suggestion]
analyze(dictionary, config, word) -> Array[MorphAnalysis]
stem(dictionary, config, word) -> String?
explain(dictionary, config, word, limit) -> Explanation
decode_bytes(bytes, encoding) -> Stringmoon run cmd/main -- validate <aff> <dic>
moon run cmd/main -- check <aff> <dic> <word>...
moon run cmd/main -- suggest <aff> <dic> <word> --limit 10
moon run cmd/main -- stem <aff> <dic> <word>
moon run cmd/main -- analyze <aff> <dic> <word> [--format json]
moon run cmd/main -- explain <aff> <dic> <word> [--limit N] [--format json]moon run --target native cmd/main -- check /path/to/en_US.aff /path/to/en_US.dic hello exsample
moon run --target native cmd/main -- suggest /path/to/en_US.aff /path/to/en_US.dic exsample --limit 5moon run --target native examples/basicmoon run --target native cmd/bench -- testdata/bench.aff testdata/bench.dic 1000moon check --target all
moon test
moon run cmd/main -- version
moon build --target native
moon run --target native cmd/main -- versionpub suberror AffixParseError {
InvalidAffixHeader(Int, String)
InvalidAffixRule(Int, String)
}pub(all) struct AffixConfig {
encoding : String
language : String
ignore_chars : String
break_enabled : Bool
break_explicit : Bool
break_patterns : Array[String]
flag_mode : String
try_chars : String
keyboard : String
word_chars : String
flag_aliases : Array[String]
morph_aliases : Array[String]
prefixes : Array[AffixRule]
suffixes : Array[AffixRule]
replacements : Array[ReplacementRule]
phone_rules : Array[PhoneRule]
iconv_rules : Array[ReplacementRule]
oconv_rules : Array[ReplacementRule]
maps : Array[String]
forbidden_word : String?
force_ucase : String?
keep_case : String?
need_affix : String?
no_suggest : String?
circumfix : String?
max_ngram_sugs : Int
complex_prefixes : Bool
check_sharps : Bool
compound_min : Int
compound_word_max : Int
compound_flag : String?
compound_begin : String?
compound_middle : String?
compound_end : String?
compound_permit : String?
compound_forbid : String?
only_in_compound : String?
check_compound_dup : Bool
check_compound_rep : Bool
check_compound_case : Bool
check_compound_triple : Bool
simplified_triple : Bool
compound_rules : Array[String]
compound_patterns : Array[CompoundPattern]
unsupported : Array[String]
}pub(all) struct AffixRule {
kind : AffixKind
flag : String
cross_product : Bool
strip : String
add : String
continuation : String
condition : String
}pub(all) struct CompoundPattern {
end_chars : String
end_flag : String?
end_zero : Bool
begin_chars : String
begin_flag : String?
replacement : String?
}pub(all) struct Explanation {
accepted : Bool
steps : Array[String]
suggestions : Array[Suggestion]
}pub(all) struct MorphAnalysis {
word : String
stem : String?
prefix : String?
suffix : String?
flags : String
morphology : String
}pub(all) struct SpellResult {
accepted : Bool
stem : String?
prefix : String?
suffix : String?
}fn explain(dictionary : Dictionary, config : AffixConfig, word : String, suggestion_limit : Int) -> Explanationfn strip_bom(text : String) -> Stringfn suggest(dictionary : Dictionary, config : AffixConfig, word : String, limit : Int) -> Array[Suggestion]Install
Download zipA pure-MoonBit Hunspell-compatible spelling engine
Dependencies