This site is no longer updated.Go to new Conversational Cloud docs

$nlp.matchPatterns


Performs pattern matching for the specified text. Returns the NLPResult object that contains the ParseTree object and an indication of which pattern has worked.

How to use

Call example:

state: A
  q!: ...
  script:
    var res = $nlp.matchPatterns("test 1", ["test 1", "test 2"]);
    log(res);

Result example:

{
  "patternId": "test 1",
  "pattern": "test 1",
  "effectivePattern": "test 1",
  "score": 0.5,
  "parseTree": {
    "tag": "root",
    "pattern": "root",
    "text": "test 1",
    "words": [
      "test",
      "1"
    ],
    "_Root": "test 1"
  },
  "weight": 1
}