Documentation ¶
Overview ¶
Package Enchant provides simplified bindings to Enchant spell checking library.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Enchant ¶
type Enchant struct {
// contains filtered or unexported fields
}
Enchant is a type that encapsulates Enchant internals
func NewEnchant ¶
NewEnchant creates a new Enchant instance for access to the rest of the Enchant API.
The returned value is an Enchant struct.
Example usage:
enchant, err := enchant.NewEnchant() if err != nil { panic("Enchant error: " + err.Error()) } defer enchant.Free() fmt.Println(enchant.DictExists("zh"))
Because the Enchant package is a binding to Enchant C library, memory allocated by the NewEnchant() call has to be disposed explicitly. This is why the above example contains a deferred call to Free().
func (*Enchant) Check ¶
Check whether a given word is in the currently loaded dictionary. This wraps enchant_dict_check. It returns a boolean value: true if the word is in the dictionary, false otherwise.
func (*Enchant) DictExists ¶
DictExists wraps enchant_broker_dict_exists. It takes a language code name, such as "en_GB", as string argument, and it returns whether or not such a dictionary is installed on the system.
func (*Enchant) Free ¶
func (e *Enchant) Free()
Free frees the Enchant broker and dictionary, and needs to be called when use of the library is no longer needed to prevent memory leaks.