-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
severe bug in [] optional matching #48
Comments
I confirmed this was an issue. It affects all implementations of RiveScript; I believe I've fixed it now for this JavaScript version. Can you try testing with the latest master branch? The root cause of the issue was that the original regexp was surrounding each of the optionals with I changed it so it uses 02f236e This is the change I made. I'll make that change on the other implementations of RiveScript as well. |
Perfect! I don't have coffee/ruby installed on my box - I'm using the 1.1.4 'distro'/browserified version, but I patched that version with your changes and everything behaves as expected now. Your explanation makes perfect sense. Thanks for the lighting fast response as well. (FYI I put a similar report on chatbots.org - feel free to delete that topic/thread). |
I released version 1.1.6 that includes this fix. :) |
Hi, I integrated rivescript 1.0.6 (python interpreter) in Domogik home automation system for our butler (basically sort of a jarvis for home automation). I integrated the new 1.8.0 release today, and some of my triggers (a lot) didn't match anymore. I just find that this ticket is the root cause. Here are some example : An english one :
A french one :
The way I used [] was very usefull to put optionnal parts in some words (related to singulat and plural, masculine and feminine).
Thanks, |
Sorry this broke your code. The intended way to handle singular vs. plural is as you said,
You could also use arrays if you're going to use the same words frequently, like
I hadn't thought of optionals or alternatives used in such a way that they touch other words in the trigger, so that wasn't a supported syntax. I also don't know how to support both versions; it was definitely a bug the way it was handled before, because spaces around an optional word could be omitted and cause matching to happen in an unintuitive way. Also, the following should work now for plurals which may be a nicer syntax (as of RiveScript-JS v1.1.7 which I just released; a bug before was causing arrays not to work properly, at all probably...):
This makes an array named |
Hi, Thanks for your quick response!
This way, I would avoid to do :
Thanks, |
Hi again, a (maybe) last question : for my purpose, in french I would like to do an alias for some pronouns : if I use an array like this :
To be able to use them with a space around, I will have to do :
But for this example it will not be good :
Because I think it will be triggered only If I put a space after the '. Like this :
How would you handle this case ? Thanks, |
I found that this works:
Also this works too but looks a little uglier, both in the array declaration and its usage (the * has to touch the array to get the
The other tricky thing with having literal spaces in the array is that you can't have the final item in the array have a space at the end, because the lines of text get stripped of whitespace during parsing (same goes for if you wanted a prefix space as the first array element... after the name and value are separated out by the |
Hi,
Unless this expected behaviour, there seem to be a pretty bad bug in the way optionals are matched.
Given the following rule;
an input of "aabogus" (notice no space!) gives an output of "TRIGGER", completely ignoring the space in the rule.
Contrast this with the use of an alternative;
an input of "aabogus" (again, notice no space) does not match, respecting the space in the rule.
Worse, something like this
Causes an input like "your fly is undone" "yoghurt is yummy" "hide and seek is fun" and "hip hip hurrah" to match.
In the off chance this is expected behaviour, I'd love to know what I'm doing wrong and how to properly construct my rules...
Tx!
The text was updated successfully, but these errors were encountered: