aichaos / rivescript-go

A RiveScript interpreter for Go. RiveScript is a scripting language for chatterbots.
https://www.rivescript.com/
MIT License
60 stars 16 forks source link

Redirects should be lowercased #1

Closed kirsle closed 7 years ago

kirsle commented 8 years ago

When a redirection is called for a different reply, the text should be lowercased and probably run through the same filters that an original message is.

The following code demonstrates the issue:

! var master = Kirsle

+ my name is (<bot master>)
- <set name=<formal>>That's my master's name too.

+ call me <bot master>
@ my name is <bot master>

If you say "call me kirsle" it will try to redirect and find a match for my name is Kirsle (with a capital K), which doesn't satisfy the regular expression /my name is kirsle/ of the first trigger. The result is a "No reply matched" error.

Lowercasing it in the RiveScript code doesn't work around this problem:

+ call me <bot master>
@ my name is {lowercase}<bot master>{/lowercase}

Catching it in a <star> works though in the mean time:

+ call me (<bot master>)
@ my name is <star>

Also look into the other RiveScript implementations and see if they're affected by this bug.