sif

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2022 License: MPL-2.0 Imports: 6 Imported by: 0

README

sif

A powerful typo checking library using pure Go.

Examples

package main

import (
  "fmt"

  "github.com/ilmiofiume/sif"
)

func main() {
  sif.SetDictionary([]string{"i", "love", "you", "my", "river"})
  fmt.Println(sif.IsTrue("i lvoe")) //=> false
  fmt.Println(sif.Suggest("lvoe")) //=> ["love", ...]
}

License

sif is licensed under the terms of Mozilla Public License 2.0.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendDictionary

func AppendDictionary(dict []string)

It is used to add new words to the preset dictionary.

func IsTrue

func IsTrue(text string) bool

Checks whether the passed sentence or word is correct.

func LoadDictionary

func LoadDictionary(path string) error

sif reads the passed file path and assigns it as a dictionary.

func SetDictionary

func SetDictionary(dict []string)

It is used to set the dictionary to be looked at when checking for typos.

func Suggest

func Suggest(text string) []string

Makes suggestions based on the dictionary.

Types

type Pair

type Pair struct {
	Key   string
	Value int
}

type PairList

type PairList []Pair

func (PairList) Len

func (p PairList) Len() int

func (PairList) Less

func (p PairList) Less(i, j int) bool

func (PairList) Swap

func (p PairList) Swap(i, j int)

Jump to

Keyboard shortcuts

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