rivescript-python icon indicating copy to clipboard operation
rivescript-python copied to clipboard

can't use array and sub at same time !!

Open elpimous opened this issue 8 years ago • 2 comments

here is the problem :

// my bot is controlled with pocketsphinx, so never numeric numbers. Each value is alphabetic. So I need to automatic convert with sub

begin :

! array number = un deux trois

! sub   one     = 1
! sub           two     = 2

question :

+ I am (@number) years old  //really need array 
- <star> ? Good !

elpimous avatar Aug 14 '16 10:08 elpimous

+ i am # years old
- <star>? Good!

The numeric wildcard # is the best for this. Use substitutions to turn all the text versions of numbers into integers.

! sub un = 1
! sub deux = 2
! sub trois = 3
! sub one = 1
! sub two = 2
! sub three = 3

It may also be easier to pre-process the user's message to handle substituting the text numbers for numeric numbers. There's some ideas here for that. This might be more efficient depending how many numbers you expect to deal with, as adding hundreds of substitutions can slow down the bot since it has to check every single one on every message.

kirsle avatar Aug 17 '16 17:08 kirsle

thanks Noah for link. Very interesting. And I can't use # character, 'cause all triggers are vocal, and alphabetics only. I'll try with a macro.

elpimous avatar Aug 20 '16 20:08 elpimous