https://github.com/makifdb/spellcheck
Simple spell checker package for Go
https://github.com/makifdb/spellcheck
golang spell-check spell-checker spellcheck spellchecker
Last synced: about 1 year ago
JSON representation
Simple spell checker package for Go
- Host: GitHub
- URL: https://github.com/makifdb/spellcheck
- Owner: makifdb
- License: mit
- Created: 2023-03-20T01:01:47.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-20T01:05:02.000Z (about 3 years ago)
- Last Synced: 2025-04-04T19:16:05.341Z (about 1 year ago)
- Topics: golang, spell-check, spell-checker, spellcheck, spellchecker
- Language: Go
- Homepage:
- Size: 1.03 MB
- Stars: 7
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# spellcheck
## Simple Spell Checker Package for Go
This is a simple spellchecker package for the Go programming language. It allows you to check the spelling of words in English. It also provides suggestions for misspelled words.
## Installation
To install the package, simply run the following command:
```go
go get github.com/makifdb/spellcheck
```
## Usage
To use the package, simply import it into your project and create a new spellchecker instance. You can then use the spellchecker to check the spelling of words and get suggestions for misspelled words. You can also insert new words into the dictionary.
```go
package main
import (
"fmt"
"github.com/makifdb/spellcheck"
)
func main() {
// Init spellchecker
sc, err := spellcheck.New()
if err != nil {
fmt.Println(err)
}
// Check spelling of a word
ok := sc.SearchDirect("hllo")
if !ok {
fmt.Println("Word is misspelled or not in dictionary")
}
// Check spelling of a word and get suggestions
ok, suggestions := sc.Search("hllo")
if !ok {
fmt.Println("Word is misspelled or not in dictionary")
if len(suggestions) > 0 {
fmt.Println("Did you mean: ", suggestions)
}
}
// Insert a word into the dictionary
sc.Insert("hllo")
}
```
## License
This package is licensed under the MIT license. See the LICENSE file for more details.