Uh oh! We couldn’t find any match.

Please try other search keywords.

Bixby Developer Center

Guides

textLib

Provides various text-related functions, especially related to fuzzy matching.

textLib~fuzzyMatch(str1, str2, [distance]) ⇒ Boolean

Perform a fuzzy string comparison using case-insensitive and punctuation-insensitive Levenshtein distance.

Input order matters, with str2 considered the "input to check", e.g. the user's request). This means that str2 must be completely subsumed by str1, within the distance threshold, but not vice versa. With a distance of two, this results in "cheese burgers" matching "cheeseburger", but not "burger", even though it's included in the user's input. It will also match "chicken salad" to "caesar salad with grilled chicken", as all of the input is included in the match.

Kind: Inner method of textLib
Access: Public

ParameterTypeDefaultDescription
str1StringInput to be checked
str2StringInput to check, or user input
[distance]Number2If negative, attempts a case-insensitive punctuation-insensitive match

textLib~spaceMixedCase(str) ⇒ String

Takes a mixedCase enum string and inserts spaces, e.g. "SouthAfrican" --> "South African"

Kind: Inner method of textLib
Access: Public

ParameterType
strString

textLib~levenshteinDistance(str1, str2) ⇒ Number

Compute the Levenshtein distance between two strings. This implementation of the algorithm is based on Wikipedia pseudo-code.

Kind: Inner method of textLib
Access: Public
See: http://en.wikipedia.org/wiki/Levenshtein_distance

ParameterType
str1String
str2String

textLib~stemAllWords(str) ⇒ Array.String

Stem all the words in the given string. This uses Porter stemming.

Kind: Inner method of textLib
Access: Public

ParameterTypeDescription
strStringThe word to stem.

textLib~stripHtml(str) ⇒ String

Strip embedded HTML from the string

Kind: Inner method of textLib
Access: Public

ParameterType
strString