AI Zone Admin Forum Add your forum

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

Check whether a word exist or not
 
 

Hello everyone,

I’m trying to detect when the user types randomly on the keyboard (things like “asdasd asdferw dsfa”).

My idea was to burst the input and check every single word with ^define().
My problem is that I don’t know how to get the canonical input: both %originalinput and %originalsentence don’t suit my case because the input is not canonized, so short forms wouldn’t be recognized as known words. I checked the documentation, but didn’t find any function that provides a canonized version of the input or words.

Am I missing something? Do you have some other solutions?

Thank you in advance.

 

 
  [ # 1 ]

I haven’t checked it, but I found “u: ( %tokenflags&#FA;ULTY;_PARSE)” in the doc.
Maybe this is what you need.
Or you could try u: ( %tokenflags&#NOT;_SENTENCE)

 

 
  [ # 2 ]

No. a word not existing has nothing to do with a successful parse.

This will count unknown words.  The canonical value of an unknown word is “unknown-word”

u: (_*1)

    if (_0 == unknown-word) { $unknowns += 1}
    ^retry(RULE)

 

 
  [ # 3 ]

No. a word not existing has nothing to do with a successful parse.

This will count unknown words.  The canonical value of an unknown word is “unknown-word”.  You get a canonical value via a match variable having matched the word.  ‘_0 is the original _0 is the canonical   ^original(_0) is what the user typed prior to spellcheck, substitution, etc.

u: (_*1)

    if (_0 == unknown-word) { $unknowns += 1}
    ^retry(RULE)

 

 
  [ # 4 ]

  You get a canonical value via a match variable having matched the word.  ‘_0 is the original _0 is the canonical   ^original(_0) is what the user typed prior to spellcheck, substitution, etc.

 

 
  [ # 5 ]

Thank you very much Bruce! That solved my problem!

 

 
  login or register to react