- Description:
- Text is a set of text-based utiltiies for bot message processing.
- Source:
Text is a set of text-based utiltiies for bot message processing.
Methods
(static) approxTextMatch(item, list, lowerCaseopt, removeSpaceopt, threshold) → {ApproximateTextMatch}
- Description:
- utility function to perform approximate string matching. This is useful in cases like voice integration where the voice recognition may not produce perfect text input, i.e., what the user says may not be perfectly converted into text. In such case, an approximate matching needs to be performed.
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
item |
string | A string to be matched to a list of strings for best approximate matching. | |
list |
Array.<string> | An array of strings to be matched with item. | |
lowerCase |
boolean |
<optional> |
if true, the item and list are first converted to lower case before matching. |
removeSpace |
boolean |
<optional> |
if true, the item and list are first stripped of space before matching. |
threshold |
number | A number between 0 and 1, with higher number meaning higher similarity. |
Returns:
The best match if it matches above the similarity threshold provided.
- Type
- ApproximateTextMatch