BasicEvaluator
Extends: module:activities/text/Evaluator.Evaluator
Source: Evaluator.js:229
A basic evaluator that just compares texts, without looking for possible coincidences of text
fragments once erroneous characters removed.
Constructor
new BasicEvaluator(className: string): BasicEvaluatorBasicEvaluator constructor
Parameters
className(string) — The class name of this evaluator.
Instance Methods
init(locales: Array.<string>)
Initializes the collator.
Parameters
locales(Array.<string>) — An array of valid locales to be used by the Inlt.Collator object
_checkText(text: string, match: string): boolean
Performs the validation of a string against a single match.
Parameters
text(string) — The text to be checkedmatch(string) — A valid expression with which to compare.
Returns
boolean
_evalText(text: string, match: string): 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). See
ComplexEvaluator for more detailed analysis of answers.
Parameters
text(string) — The text to be checkedmatch(string) — A valid expression with which to compare.
Returns
Array.<number>
getClearedText(src: string, skipped: Array.<boolean>): string
Removes double spaces and erroneous characters from a given text expression.
Parameters
src(string) — The text to be processed.skipped(Array.<boolean>) — An array of boolean indicating which characters should be removed
from the string.
Returns
string
setProperties($xml: external:jQuery)
Inherited from module:activities/text/Evaluator.Evaluator#setProperties
Overrides: module:activities/text/Evaluator.Evaluator#setProperties
Loads the object settings from a specific JQuery XML element
Parameters
$xml(external:jQuery) — The jQuery XML element to parse
getAttributes(): object
Inherited from module:activities/text/Evaluator.Evaluator#getAttributes
Overrides: module:activities/text/Evaluator.Evaluator#getAttributes
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.
Returns
object
init(locales: Array.<string>)
Inherited from module:activities/text/Evaluator.BasicEvaluator#init
Overrides: module:activities/text/Evaluator.Evaluator#init
Initializes the collator.
Parameters
locales(Array.<string>) — An array of valid locales to be used by the Inlt.Collator object
checkText(text: string, match: string | Array.<string>): boolean
Inherited from module:activities/text/Evaluator.Evaluator#checkText
Overrides: module:activities/text/Evaluator.Evaluator#checkText
Checks the given text against a set of valid matches
Parameters
text(string) — The text to be checkedmatch(string | Array.<string>) — The valid expression or expressions with which to compare.
Returns
boolean
_checkText(text: string, match: string): boolean
Inherited from module:activities/text/Evaluator.BasicEvaluator#_checkText
Overrides: module:activities/text/Evaluator.Evaluator#_checkText
Performs the validation of a string against a single match.
Parameters
text(string) — The text to be checkedmatch(string) — A valid expression with which to compare.
Returns
boolean
evalText(
text: string,
match: string | Array.<string>,
): Array.<number>
Inherited from module:activities/text/Evaluator.Evaluator#evalText
Overrides: module:activities/text/Evaluator.Evaluator#evalText
Evaluates the given text against a set of valid matches, returning an array of flags useful
to indicate where the mistakes are located.
Parameters
text(string) — The text to be checkedmatch(string | Array.<string>) — The valid expression or expressions with which to compare.
Returns
Array.<number>
_evalText(text: string, match: string): Array.<number>
Inherited from module:activities/text/Evaluator.BasicEvaluator#_evalText
Overrides: module:activities/text/Evaluator.Evaluator#_evalText
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). See
ComplexEvaluator for more detailed analysis of answers.
Parameters
text(string) — The text to be checkedmatch(string) — A valid expression with which to compare.
Returns
Array.<number>
isOk(flags: Array.<number>): boolean
Inherited from module:activities/text/Evaluator.Evaluator#isOk
Overrides: module:activities/text/Evaluator.Evaluator#isOk
Checks if the given array of flags (usually returned by evalText) can be considered as a
valid or erroneous answer.
Parameters
flags(Array.<number>)
Returns
boolean
init(locales: Array.<string>)
Inherited from module:activities/text/Evaluator.BasicEvaluator#init
Overrides: module:activities/text/Evaluator.Evaluator#init
Initializes the collator.
Parameters
locales(Array.<string>) — An array of valid locales to be used by the Inlt.Collator object
_checkText(text: string, match: string): boolean
Inherited from module:activities/text/Evaluator.BasicEvaluator#_checkText
Overrides: module:activities/text/Evaluator.Evaluator#_checkText
Performs the validation of a string against a single match.
Parameters
text(string) — The text to be checkedmatch(string) — A valid expression with which to compare.
Returns
boolean
_evalText(text: string, match: string): Array.<number>
Inherited from module:activities/text/Evaluator.BasicEvaluator#_evalText
Overrides: module:activities/text/Evaluator.Evaluator#_evalText
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). See
ComplexEvaluator for more detailed analysis of answers.
Parameters
text(string) — The text to be checkedmatch(string) — A valid expression with which to compare.
Returns
Array.<number>
Static Methods
getEvaluator(
$xml: external:jQuery,
): module:activities/text/Evaluator.Evaluator
Inherited from module:activities/text/Evaluator.Evaluator
Factory constructor that returns a specific type of Evaluator based on the class
attribute declared in the $xml element.
Parameters
$xml(external:jQuery) — The XML element to be parsed.
Returns
factory(
data: object,
): module:activities/text/Evaluator.Evaluator
Inherited from module:activities/text/Evaluator.Evaluator
Builds a new Evaluator, based on the properties specified in a data object
Parameters
data(object) — The data object to be parsed
Returns
Instance Fields
checkAccents: boolean
Whether accented letters must be considered equivalent or not.
checkPunctuation: boolean
Whether to check or not dots, commas and other punctuation marks when comparing texts.
checkDoubleSpaces: boolean
Whether to check or not the extra spaces added between words.
PUNCTUATION: string
String containing all the characters considered as punctuation marks (currently ".,;:")
className: string
Inherited from module:activities/text/Evaluator.Evaluator#className
Overrides: module:activities/text/Evaluator.Evaluator#className
The type of evaluator.
initiated: boolean
Inherited from module:activities/text/Evaluator.Evaluator#initiated
Overrides: module:activities/text/Evaluator.Evaluator#initiated
Whether this evaluator has been initialized or not.
collator: external:Collator
Inherited from module:activities/text/Evaluator.Evaluator#collator
Overrides: module:activities/text/Evaluator.Evaluator#collator
The Intl.Collator object used to compare strings, when available.
checkcase: boolean
Inherited from module:activities/text/Evaluator.Evaluator#checkcase
Overrides: module:activities/text/Evaluator.Evaluator#checkcase
Whether uppercase and lowercase expressions must be considered equivalent or not.