hunspell

package
v0.53.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2024 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package hunspell is a library to parse the Hunspell file format.

Index

Constants

View Source
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.

View Source
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.

View Source
const (
	DefaultEncoding = EncodingUTF8
	DefaultFlag     = FlagASCII
)

List of default values.

Variables

This section is empty.

Functions

func MergeDictionaries

func MergeDictionaries(outFile string, inFiles ...string) (n int, err error)

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 added in v0.14.0

type Morphemes map[string]string

Morphemes contains list of morphological attributes.

func (Morphemes) String added in v0.14.0

func (morphs Morphemes) String() 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

func Open(affpath, dpath string) (spell *Spell, err error)

Open create and initialize new Spell from affix and dictionary files.

func (*Spell) AddDictionary

func (spell *Spell) AddDictionary(path string) (err error)

AddDictionary from file "path".

func (*Spell) Analyze added in v0.14.0

func (spell *Spell) Analyze(word string) Morphemes

Analyze return the morphological fields of the word and its parent. It will return nil if word is unknown.

func (*Spell) Spell

func (spell *Spell) Spell(word string) (stem *Stem)

Spell return the stem of "word" if its recognized by Spell; otherwise it will return nil.

func (*Spell) Stem added in v0.14.0

func (spell *Spell) Stem(word string) *Stem

Stem reduce inflected (or sometimes derived) words to their word stem, base, or root form.

type Stem added in v0.14.0

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 added in v0.14.0

func (stem *Stem) Analyze() Morphemes

Analyze return the morphological fields of the stem and its parent stem.

func (*Stem) Stem added in v0.14.0

func (stem *Stem) Stem() *Stem

Stem reduce inflected (or sometimes derived) words to their word stem, base, or root form.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL