spell

package
v0.9.7 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2019 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package spell provides functions for spell check and correction

Index

Constants

This section is empty.

Variables

View Source
var Ignore []string

Functions

func CheckWord

func CheckWord(w string) (suggests []string, known bool, err error)

CheckWord checks a single word and returns suggestions if word is unknown Programs should call gi.CheckWord - all program calls should be done through that single API

func Complete

func Complete(s string) (result []string, err error)

Complete finds possible completions based on the prefix s

func DoIgnore

func DoIgnore(word string) bool

DoIgnore returns true if the word is found in the Ignore list

func IgnoreWord

func IgnoreWord(word string)

IgnoreWord adds the word to the Ignore list

func Initialized

func Initialized() bool

Initialized returns true if the model has been loaded or created anew

func LearnWord

func LearnWord(word string)

LearnWord adds a single word to the corpus

func Load

func Load(path string) (err error)

Load loads the saved model stored in json format

func Save

func Save(filename string) error

Save saves the spelling model which includes the data and parameters

func Train

func Train(file os.File, new bool) (err error)

Types

type EditData

type EditData struct {
	NewText string `desc:"spelling correction text after special edits if needed"`
}

func CorrectText

func CorrectText(old string, new string) (ed EditData)

CorrectText replaces the old unknown word with the new word chosen from the list of corrections delta is the change in cursor position (cp).

type EditFunc

type EditFunc func(data interface{}, new string, old string) EditData

EditFunc is passed the current word and the selected correction for text editing.

Jump to

Keyboard shortcuts

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