package hunspell
import "git.sr.ht/~shulhan/pakakeh.go/lib/_hunspell"
Package hunspell is a library to parse the Hunspell file format.
Index ¶
- Constants
- func MergeDictionaries(outFile string, inFiles ...string) (n int, err error)
- type Morphemes
- type Spell
- func New() (spell *Spell)
- func Open(affpath, dpath string) (spell *Spell, err error)
- func (spell *Spell) AddDictionary(path string) (err error)
- func (spell *Spell) Analyze(word string) Morphemes
- func (spell *Spell) Spell(word string) (stem *Stem)
- func (spell *Spell) Stem(word string) *Stem
- type Stem
Constants ¶
const ( EncodingUTF8 = "UTF-8" // Default EncodingISO8859_1 = "ISO8859-1" EncodingISO8859_2 = "ISO8859-2" EncodingISO8859_3 = "ISO8859-3" EncodingISO8859_4 = "ISO8859-4" EncodingISO8859_5 = "ISO8859-5" EncodingISO8859_6 = "ISO8859-6" EncodingISO8859_7 = "ISO8859-7" EncodingISO8859_8 = "ISO8859-8" EncodingISO8859_9 = "ISO8859-9" EncodingISO8859_10 = "ISO8859-10" EncodingISO8859_13 = "ISO8859-13" EncodingISO8859_14 = "ISO8859-14" EncodingISO8859_15 = "ISO8859-15" EncodingKOI8R = "KOI8-R" EncodingKOI8U = "KOI8-U" EncodingCP1251 = "CP1251" EncodingISCIIDevanagri = "ISCII-DEVANAGRI" )
List of valid SET values.
const ( // Default flag with single character. FlagASCII = "ascii" // `UTF-8' parameter sets UTF-8 encoded Unicode character flags, // single character. FlagUTF8 = "utf-8" // The `long' value sets the double extended ASCII character flag // type, double ASCII characters. FlagLong = "long" // Decimal flags numbered from 1 to 65000, and in flag fields are // separated by comma. FlagNum = "num" )
List of valid flag values.
const ( DefaultEncoding = EncodingUTF8 DefaultFlag = FlagASCII )
List of default values.
Functions ¶
func MergeDictionaries ¶
MergeDictionaries merge two or more dictionaries into single file. The outFile define the output of merged dictionaries. If the outFile already exist it will be truncated, otherwise it will be created. The inFiles contains list of input dictionary files.
On success it will return number of words merged into output file.
Types ¶
type Morphemes ¶
Morphemes contains list of morphological attributes.
func (Morphemes) String ¶
String return list of morphological fields ordered by key.
type Spell ¶
type Spell struct {
// contains filtered or unexported fields
}
Spell contains list of options, root words, expanded words, and affixes.
func New ¶
func New() (spell *Spell)
New create and initialize default Spell.
func Open ¶
Open create and initialize new Spell from affix and dictionary files.
func (*Spell) AddDictionary ¶
AddDictionary from file "path".
func (*Spell) Analyze ¶
Analyze return the morphological fields of the word and its parent. It will return nil if word is unknown.
func (*Spell) Spell ¶
Spell return the stem of "word" if its recognized by Spell; otherwise it will return nil.
func (*Spell) Stem ¶
Stem reduce inflected (or sometimes derived) words to their word stem, base, or root form.
type Stem ¶
type Stem struct { Word string Morphemes Morphemes Parent *Stem IsForbidden bool // contains filtered or unexported fields }
Stem contains the word and its attributes.
func (*Stem) Analyze ¶
Analyze return the morphological fields of the stem and its parent stem.
func (*Stem) Stem ¶
Stem reduce inflected (or sometimes derived) words to their word stem, base, or root form.
Source Files ¶
affix.go affix_rule.go breakopt.go charsmap.go compound_pattern.go compound_rule.go compound_syllable.go conversion.go dictionary.go flags.go hunspell.go morphemes.go options.go replacement.go spell.go stem.go
Directories ¶
Path | Synopsis |
---|---|
lib/_hunspell/tests |
- Version
- v0.60.0 (latest)
- Published
- Feb 1, 2025
- Platform
- linux/amd64
- Imports
- 12 packages
- Last checked
- 5 minutes ago –
Tools for package owners.