ibm-cloud-docs / assistant

22 stars 58 forks source link

how can we check if input.original_text exists or not? #395

Closed henrywill4 closed 7 months ago

henrywill4 commented 3 years ago

This article mentions that input.original_text only is created if a spelling correction takes place, so we need to check if it exists. Well, how can we check if input.original_text exists or not? I'm searching the docs and not finding how to do that.

henrywill4 commented 3 years ago

With lots of trying and testing, we can up with this condition to check input.text?.toLowerCase()?.contains('~iat') || input.original_text?.toLowerCase()?.contains('~iat')

henrywill4 commented 3 years ago

another alternative from https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-methods#dialog-methods-objects-jsonobject-has

perhaps check for input.has(original_text) as an alternative