Loads and sets translations
Type: object
Indicates, that no decision could be made
Highest tolerated Distance for Levenshtein
Type: number
Searchs through Array, to find the word that is closest to the word given as parameter
(string)
The Word, that was given as an Input
{distance: number, goal: string}
:
Returns an Object containing the closest word and its distance. If no word is found, the method returns
invalid
Indicates that an Invalid Argument was given
Extends Error
(any)
Calculates the Sum of an Array
number
:
sum
Splits a String in Groups of words
(number)
The offset at which the splitting should start; for example if offset equals one, the first word is put in the Array as an entry, for 2 it's the first two words, and so on. Must be smaller than
subSize
(string)
The String to be split
(number)
The Number of words to leave together. Defaults to two if undefined, if smaller then one,
string
will be returned
Array<string>
:
Array of split wordgroups
Divides a Sentence in Parts, each having not more than subSize
words, sends these to minimal distance and calculates than, which is most likely to be correct
Uses the formula described here
(string)
The Sentence to be interpreted
number
:
Returns Index of the Entry that is most likely
Adds or overrides translations
(any)
An object containing the translations to be added in the same format as in the default lang files
Removes unnecessary words from string. Unnecessary words are to be defined in the language files as Array named garbage
string
:
String with removed Words
Decides, if word is most likely Yes, No or Maybe (including Variations) and uses language
{distance: number, goal: string}
:
Decides if yes, no or maybe was most likely meant
Names MUST be two-letter code, like the examples