hunspell

package module
v0.0.0-...-5d8374a Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2022 License: BSD-3-Clause Imports: 6 Imported by: 1

README

hunspell

The hunspell package provides bindings to the hunspell spelling library.

Documentation

Overview

Package hunspell provides bindings to the hunspell spelling library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Paths

func Paths(path, lang string) (aff, dic string, err error)

Paths is a convenience function that returns the paths for the affix rule and dictionary files for a given root path and language key.

Types

type Spell

type Spell struct {
	// contains filtered or unexported fields
}

Spell is a hunspell spelling checker. A Spell is only valid if it is returned by a successful call to NewSpell or NewSpellPaths.

func NewSpell

func NewSpell(path, lang string) (*Spell, error)

NewSpell returns a spelling checker initialized with the dictionary specified by the lang key located in the given path. NewSpell called with both parameters empty will return a valid empty spell checker. If lang is empty and path is not, an error is returned. NewSpell checks for the existence of the dictionary files.

func NewSpellPaths

func NewSpellPaths(affix, dict string) (*Spell, error)

NewSpellPaths returns a spelling checker initialized with the dictionary specified by the affix rule and dictionary files. NewSpellPaths checks for the existence of the each file if the path is not empty.

func (*Spell) Add

func (s *Spell) Add(word string) (ok bool)

Add adds the provided word to the run-time dictionary.

func (*Spell) AddDict

func (s *Spell) AddDict(path string) error

AddDict adds extra dictionary (.dic file) to the run-time dictionary.

func (*Spell) AddWithAffix

func (s *Spell) AddWithAffix(word, example string) (ok bool)

AddWithAffix adds the provided word to the run-time dictionary including affix information from the dictionary example word.

func (*Spell) Analyze

func (s *Spell) Analyze(word string) []string

Analyze returns a morphological analysis of the word.

func (*Spell) IsCorrect

func (s *Spell) IsCorrect(word string) bool

IsCorrect returns whether the provided word is spelled correctly.

func (*Spell) Remove

func (s *Spell) Remove(word string) (ok bool)

Remove removes the provided word from the run-time dictionary.

func (*Spell) Stem

func (s *Spell) Stem(word string) []string

Stem returns the stems of the provided word.

func (*Spell) Suggest

func (s *Spell) Suggest(word string) []string

Suggest returns suggestions for the provided word.

Jump to

Keyboard shortcuts

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