AI Zone Admin Forum Add your forum

NEWS: survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

Understanding pattern matching concept

I think I am missing something in my understanding of basic pattern matching.

For example, when I test the pattern:

:testpattern (switchtopic)switchtopic

where “switchtopic” is just my own made up string literal.  However, the match failed.

Here is the trace:

Incoming data- henry | aimee |  :testpattern (switchtopic)switchtopic

Original Input: switchtopic
Tokenized Input: switchtopic
Spellchecked Input: switch topic


1: switch raw=  ~mainverb ~verb_infinitive ~verb switch ~tool ~controllers ~artifacts ~objects ~nouns
. . . . ,  ~disable ~alter_functionality_verbs ~affect_object_verbs ~animate_verbs ~verbs ~substitute
. . . . ,  interchange~5 exchange~12 shift~11 shift~13 switch~12 flip~12 swop~2 //
1: switch canonical=  ~childword // 

2: topic raw=  ~mainobject ~noun ~noun_singular ~noun_bits topic ~focus matter~5 content~2 knowledge~1
. . . . ,  psychological_feature~1 abstraction~1 entity~1 ~nounroot subject~6 substance~5 communication~1 //
2: topic canonical=  ~childword // 


Tagged POS 2 words: switch (MAINVERB Verb_infinitive)  topic (MAINOBJECT Noun_singular) 
  MainSentence: switch topic   PRESENT

  he=  she=  he-she=  it=topic they=  here=  there=
. ( switchtopic Failed

Here is another test that also failed:

:testpattern (a1b2c3)a1b2c3

Incoming data- henry | aimee |  :testpattern (a1b2c3)a1b2c3

Original Input: a1b2c3
Tokenized Input: a1b2c3


1: a1b2c3 raw=  ~mainverb ~noun ~noun_singular ~noun_bits //
1: unknown-word canonical=  unknown-word // 

Tagged POS 1 words: a1b2c3/unknown-word (MAINVERB Noun_singular) 
  MainSentence: a1b2c3 PRESENT

  he=  she=  he-she=  it=a1b2c3 they=  here=  there=
. ( a1b2c3 Failed


  [ # 1 ]

the default bot has spelling correction turned on.
So your input was fixed from switchtopic to switch topic (2 words).
Your keyword in pattern is not subject to spelling correction so it remains unchanged. Though when you compiled it it might have warned you it wasnt a recognized word.


  [ # 2 ]

Mystery solved!  Thank you.


  login or register to react