damerau

package module
v0.0.0-...-4823bff Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2017 License: MIT Imports: 5 Imported by: 4

README

Damerau–Levenshtein distance

This is a spelling corrector implementing the Damerau-Levenshtein distance. Takes a string value input from the user. Looks for an identical word on a list of words, if none is found, look for a similar word.

Getting Started

To install the damerau package:

$ go get github.com/ambrevar/damerau

To use it in a program:

import "github.com/ambrevar/damerau"

To install it immediately for command-line use:

$ go get github.com/ambrevar/damerau/damerau

The program must be given two arguments for command line use:

  1. Path to a text file containing a lot of words (e.g. the word.txt file in the damerau folder in this repository)
  2. Single erroneous string value (e.g. korrecter, commanderr)

Example command-line usage:

$ damerau -file="words.txt" -word="korrecter"

Output: [correct correctly correct.]

Version notes

This code used to be hosted at "github.com/jhprks/damerau" until it went down some time in 2017.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Correct

func Correct(input string, lines []string) ([]string, error)

Correct takes the input and returns all the top candidates

func DamerauLevenshteinDistance

func DamerauLevenshteinDistance(s, t string) int

DamerauLevenshteinDistance is damerau levenshtein distance, it computes the edit distance between two strings with transposition the measurements are: deletion, insertion, substituion, transposition

func ReadString

func ReadString(filename string) ([]string, error)

ReadString reads a file and returns array of strings representing every line

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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