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..

More escapology!
 
 

Finally getting back to my bot after a long break due to pressures of work, and it seems like I’ve forgotten so much, because I feel like I should be able to solve this myself.

Bot: How tall are you?
User: I’m 5 11

The above works, but…

Bot: How tall are you?
User: I’m 5’ 11”

This makes the bot think the user is vertically challenged - the first quote means the inch value never gets picked up.

Here’s the line of code:

a: ( _~number{"'"} _~number * ) $userheight = ^compute (^compute( _0 * 12 ) + _1 )

Any ideas what I’m doing wrong?

 

 
  [ # 1 ]

:prepare is your friend.

With the default token control settings, I’m 5’ 11” will be prepared to I am 5 inches 11 and that makes your pattern so much easier (_~number inches _~number)

 

 
  [ # 2 ]

Though I’ve just read the Chatscript training PDF that was posted to Sourceforge which has this very example and that implies that the input should be converted to 5 foot 11 inch.

But that is not the case for me with a clean install of 6.2g.


(And I misread the prepare output earlier - it does use the canonical word inch not inches).

 

 
  [ # 3 ]

Thanks Andy!

It does appear that the translation of inches and feet have been transposed.

However, you got me on the right track and my working code is now as follows:

a: ( _~number { ~measurelist } _~number { ~measurelist } ) $userheight = _0 * 12 + _1

Just for jollies, I may have to think about an extra line or two to accommodate metric measurements.

Thanks again, I would have taken forever to work this out left to my own devices!

 

 
  [ # 4 ]

No problem.

As food for thought, you’ll need to adjust your pattern to account for some-one saying that are “6 feet”, i.e. there are no inches and so that second number might not be there.

 

 
  [ # 5 ]

cs bug, fixed in next release

 

 
  [ # 6 ]

Bug fix now out

 

 
  login or register to react