Constructor
new BasicEvaluator(className)
BasicEvaluator constructor
Name | Type | Description |
---|---|---|
className | string | The class name of this evaluator. |
Extends
Members
PUNCTUATION :string
String containing all the characters considered as punctuation marks (currently ".,;:")
- string
checkAccents :boolean
Whether accented letters must be considered equivalent or not.
- boolean
checkDoubleSpaces :boolean
Whether to check or not the extra spaces added between words.
- boolean
checkPunctuation :boolean
Whether to check or not dots, commas and other punctuation marks when comparing texts.
- boolean
checkcase :boolean
Whether uppercase and lowercase expressions must be considered equivalent or not.
- boolean
className :string
The type of evaluator.
- string
collator :external:Collator
The Intl.Collator object used to compare strings, when available.
initiated :boolean
Whether this evaluator has been initialized or not.
- boolean
Methods
_checkText(text, match) → {boolean}
Performs the validation of a string against a single match.
Name | Type | Description |
---|---|---|
text | string | The text to be checked |
match | string | A valid expression with which to compare. |
true
when the two expressions can be considered equivalent.
- Type:
- boolean
_evalText(text, match) → {Array.<number>}
Performs the evaluation of a string against an array of valid matches, returning an array of
flags useful to indicate where the mistakes are located.
In BasicEvaluator, all characters are just marked as 1 (error) or 0 (OK). SeeComplexEvaluator
for more detailed analysis of answers.
Name | Type | Description |
---|---|---|
text | string | The text to be checked |
match | string | A valid expression with which to compare. |
- An array of flags (one number for character) indicating whether each
position is erroneous or OK.
- Type:
- Array.<number>
checkText(text, match) → {boolean}
Checks the given text against a set of valid matches
Name | Type | Description |
---|---|---|
text | string | The text to be checked |
match | string | | The valid expression or expressions with which to compare. |
true
if the checked expression is valid,false
otherwise.
- Type:
- boolean
evalText(text, match) → {Array.<number>}
Evaluates the given text against a set of valid matches, returning an array of flags useful
to indicate where the mistakes are located.
Name | Type | Description |
---|---|---|
text | string | The text to be checked |
match | string | | The valid expression or expressions with which to compare. |
- An array of flags (one number for character) indicating whether each
position is erroneous or ok.
- Type:
- Array.<number>
getAttributes() → {object}
Gets a object with the basic attributes needed to rebuild this instance excluding functions,
parent references, constants and also attributes retaining the default value.
The resulting object is commonly usued to serialize elements in JSON format.
- The resulting object, with minimal attrributes
- Type:
- object
getClearedText(src, skipped) → {string}
Removes double spaces and erroneous characters from a given text expression.
Name | Type | Description |
---|---|---|
src | string | The text to be processed. |
skipped | Array.<boolean> | An array of boolean indicating which characters should be removed |
- Type:
- string
init(locales)
Initializes the collator
.
Name | Type | Description |
---|---|---|
locales | Array.<string> | An array of valid locales to be used by the Inlt.Collator object |
isOk(flags) → {boolean}
Checks if the given array of flags (usually returned by evalText
) can be considered as a
valid or erroneous answer.
Name | Type | Description |
---|---|---|
flags | Array.<number> |
true
when there is at least one flag and all flags are 0 (meaning no error).
- Type:
- boolean
setProperties($xml)
Loads the object settings from a specific JQuery XML element
Name | Type | Description |
---|---|---|
$xml | external:jQuery | The jQuery XML element to parse |