goagrep

package
v0.0.0-...-063f2dd Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2016 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Normalize bool
View Source
var VERBOSE bool

VERBOSE is a flag to turn on/off status information during parsing

Functions

func GenerateDB

func GenerateDB(stringListPath string, databasePath string, tupleLength int, verbosity bool)

GenerateDB generates the database with precomputed strings for later searching. It is required to you generate a database before you use the GetMatch() function.

stringListPath is the filename of the list of strings you want to use

databasePath is the filename of the database that is outputed

tupleLength is the length of the subsets you want to use

func GenerateDBInMemory

func GenerateDBInMemory(stringListPath string, tupleLength int, verbosity bool) (words map[int]string, tuples map[string][]int)

func GetMatch

func GetMatch(s string, path string) (string, int, error)

GetMatch searches in the specified goagrep database. It returns the closest matched string and the Levenshtein distance.

s is the string you want to search

path is the filename of the database generated with GenerateDB()

func GetMatches

func GetMatches(s string, path string) ([]string, []int, error)

GetMatches searches in the specified goagrep database. Returns the a list of the at most 100 words and scores in order.

s is the string you want to search

path is the filename of the database generated with GenerateDB()

func GetMatchesInMemory

func GetMatchesInMemory(s string, wordsLookup map[int]string, tuplesLookup map[string][]int, tupleLength int, findBestMatch bool) ([]string, []int, error)

func GetMatchesInMemoryInParallel

func GetMatchesInMemoryInParallel(s string, wordsLookup map[int]string, tuplesLookup map[string][]int, tupleLength int, findBestMatch bool) ([]string, []int, error)

func LCS

func LCS(str1, str2 string) int

func Max

func Max(more ...int) int

Types

type Pair

type Pair struct {
	Key   string
	Value int
}

Pair structure for sorting

type PairList

type PairList []Pair

PairList array structure for sorting

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)

Notes

Bugs

Jump to

Keyboard shortcuts

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