(1.17 Resolved) Some Matching issues/questions|a2b|roy@wasystems.net|1221288699|a2b|xx|0|76.102.148.130 72.37.252.50 69.227.167.128|So I ran into a few matching issues which I think if solved would make RiveScript a lot more powerful.  <br /><br />The first one is, when trying to detect asl response I was unable to match a number right next to text. Example:<br />[code]<br />+ #male[*]<br />- response<br />[/code]<br />Same issue with trying to detect 22/f as 22f.  Is there a better approach possibly?<br /><br /><br />The second issue I found is when using multiple wildcards (1+ optional) and using them in a redirect or test case, I do not know which one I am matching with. Example:<br />[code]<br />+ # [*] test *<br />- star 1 &lt;star&gt;, star 2 &lt;star2&gt;, star 3 &lt;star3&gt;<br />[/code]<br />If I say, &quot;1 test testb&quot; you get:<br />star 1 1, star 2 testb, star 3<br /><br />If I say, &quot;1 testa test testb&quot; you get:<br />star 1 1, star 2 testa, star 3 testb<br /><br />Is it possible from a technical aspect to line up the stars with that phrase? So the output would be more like this:<br /><br />If I say, &quot;1 test testb&quot; you get:<br />star 1 1, star 2 , star 3 testb||1222039658|Kirsle|
Re: Some Matching issues/questions|a2b|roy@wasystems.net|1221299692|a2b|xx|0|76.102.148.130|Maybe it's late and I am missing something but it does not seem to respond to<br /><br />[code]<br />+ #<br />- you said &lt;star&gt;<br />[/code]<br /><br />I tried to use the following as a work around:<br /><br />[code]<br />+ [*] #<br />- you said &lt;star2&gt;<br />[/code]<br /><br />When I do this though, it does not pick up single numbers, and double digit numbers like 22 results in 'you said 2'. &nbsp;This also brings it back to the other issue I mentioned in another thread about know if it should use star1 or star2.<br /><br /><br /><br />||||
Re: Some Matching issues/questions|Kirsle|casey@cuvou.net|1221342886|Kirsle|xx|0|69.227.167.128|Technically [[b]*[/b]] shouldn't match to a &lt;star&gt; tag, and the fact that it does match is a bug (since the existence of an optional can't be guaranteed, it shouldn't have a place in the &lt;star#&gt; lineup and mess with the values of the following &lt;star&gt; tags). I know why it's matching, though, and I'll look into fixing it so that [[b]*[/b]] doesn't match...<br /><br />Options are converted like this:<br />[code]&quot;what is your [home&#124;office] phone number&quot;<br />becomes<br />&quot;what is your(?:\s*home\s*&#124;\s*office\s*&#124;\s*)phone number&quot;[/code]<br /><br />Then the *'s themselves get translated to (.+?) so the regexp becomes (?:\s*(.+?)\s*&#124;\s*)... even though the outside (?: ) syntax should avoid matching, a nested (.+?) still matches...<br /><br />The # and _ versions of the wildcard are new and I figured there'd be some bugs there... I think they just need to match like (\d+) instead of (\d+?), or something simple like that.<br /><br />I'll make sure this and your other bugs are fixed when 1.17 goes out.||||
Re: Some Matching issues/questions|Kirsle|casey@cuvou.net|1221509647|Kirsle|xx|0|72.37.252.50|[quote author=7E2D7D1F0 link=1221288699/0#1 date=1221299692]Maybe it's late and I am missing something but it does not seem to respond to<br /><br />[code]<br />+ #<br />- you said &lt;star&gt;<br />[/code]<br /><br />I tried to use the following as a work around:<br /><br />[code]<br />+ [*] #<br />- you said &lt;star2&gt;<br />[/code]<br /><br />When I do this though, it does not pick up single numbers, and double digit numbers like 22 results in 'you said 2'.  This also brings it back to the other issue I mentioned in another thread about know if it should use star1 or star2.<br /><br /><br /><br />[/quote]<br /><br />Triggers that consist only of # or _ weren't allowed initially. So during the sortReplies routine, if a trigger contained # and _ but no whole words beyond that, it wouldn't store it for the sort buffer (with a comment in the code saying &quot;Lone wildcard trigger must be * only&quot;). I can see a potential use for having # in addition to * (but _ and * coexisting gets a little dodgy) so RiveScript 1.17 will allow # and _ to exist.<br /><br />The trigger sort order is as follows now:<br /><br />[code]1. Atomic triggers, descending by # of words<br />2. Triggers w/ optionals, desc by # of words<br />3. Triggers w/ _ wildcards, desc by # of words<br />4. Triggers w/ # wildcards, desc by # of words<br />5. Triggers w/ * wildcards, desc by # of words<br />6. Trigger that equals `_`<br />7. Trigger that equals `#`<br />8. Trigger that equals `*`[/code]<br /><br />Also, a bug was that RiveScript was counting words by separating the trigger by spaces, so triggers like #male* would count as having 1 word. The logic in sortReplies was going like, &quot;the trigger contains a # wildcard, but doesn't have &gt; 1 word in it, and lone wildcards are for *'s only, ignoring this trigger completely&quot;. The new version of the module counts words by spaces and all varieties of wildcards.<br /><br />And finally, anything that goes inside an [optional] that doesn't explicitly demand that it be matched into a &lt;star&gt; tag, will not be matched into a &lt;star&gt; tag. That is to say:<br /><br />[code]+ # [*] something *<br />&lt;star1&gt; = what the # matched<br />&lt;star2&gt; = what the last * matched<br />the [*] doesn't match<br /><br />+ # [(*)] something *<br />&lt;star1&gt; = the #<br />&lt;star2&gt; = the [(*)]<br />&lt;star3&gt; = the last *[/code]<br /><br />Arrays and alternatives and such will be mostly the same.<br />[code]+ i am wearing a [@colors] shirt<br />@colors doesn't match into &lt;star&gt;<br /><br />+ i am wearing a [(@colors)] shirt<br />@colors matches into &lt;star&gt;[/code]<br /><br />To that end, I fixed a bug I found myself when writing that last example there... in conditionals, any blank value gets defaulted to &quot;undefined&quot;, so...<br /><br />[code]+ i am wearing a [(@colors)] shirt<br />* &lt;star&gt; ne undefined =&gt; Why are you wearing a &lt;star&gt; shirt?<br />- What color is it?[/code]||1221510348|Kirsle|
Re: (1.17 Verify Resolved) Some Matching issues/questions|a2b|roy@wasystems.net|1222038186|a2b|xx|0|76.102.148.130|Checked all of these out and tested them. &nbsp;Looks great!||||
