Documentation
¶
Index ¶
- func CommonPrefix(first, second string) string
- func Max(args ...int) int
- func Maxf(args ...float64) float64
- func Min(args ...int) int
- func Minf(args ...float64) float64
- func NgramIntersection(a, b []rune, size int) (map[string]int, int, int, int)
- func NgramMap(runes []rune, size int) (map[string]int, int)
- func Ngrams(runes []rune, size int) []string
- func SliceContains(terms []string, q string) bool
- func UniqueSlice(items []string) []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommonPrefix ¶
CommonPrefix returns the common prefix of the specified strings. An empty string is returned if the parameters have no prefix in common.
func NgramIntersection ¶ added in v0.2.0
NgramIntersection returns a map of the n-grams of the specified size found in both terms, along with their frequency. The function also returns the number of common n-grams (the sum of all the values in the output map), the total number of n-grams in the first term and the total number of n-grams in the second term. An n-gram size of 1 is used if the provided size is less than or equal to 0.
func NgramMap ¶ added in v0.2.0
NgramMap returns a map of all n-grams of the specified size for the provided term, along with their frequency. The function also returns the total number of n-grams, which is the sum of all the values in the output map. An n-gram size of 1 is used if the provided size is less than or equal to 0.
func Ngrams ¶ added in v0.2.0
Ngrams returns all the n-grams of the specified size for the provided term. The n-grams in the output slice are in the order in which they occur in the input term. An n-gram size of 1 is used if the provided size is less than or equal to 0.
func SliceContains ¶
SliceContains returns true if terms contains q, or false otherwise.
func UniqueSlice ¶
UniqueSlice returns a slice containing the unique items from the specified string slice. The items in the output slice are in the order in which they occur in the input slice.
Types ¶
This section is empty.