Skip to main content

$nlp.matchExamples

Performs text matching with a given set of examples. Returns:

  • closest example;
  • the number of words in the user’s phrase for which a match was found in the examples;
  • matching weight.
How to use

Call example:

state: A
q!: ...
script:
var res = $nlp.matchExamples("one one", ["one", "two", "three"]);
log(res);

Result example:

{
example: "one",
weight: 0.5,
aligned: 1
}