MycroftAI / adapt

Adapt Intent Parser
Apache License 2.0
712 stars 154 forks source link

Entity matching more than it should #116

Closed aussieW closed 2 years ago

aussieW commented 6 years ago

I am experiencing a problem with using regex. I have the following phrase defined in regex/en-us/City.rx

(for|at|in|on) (?P<city_name>.+)

but only when "on Tokyo" is spoken does it return "Tokyo". For the others it returns "for Tokyo", "at Tokyo" or "in Tokyo".

I have seen the problem on rpi3 running on both picroft and Mark 1 images.

I have a cut down version of my code at https://github.com/aussieW/regexProblem which demonstrates the problem.

aussieW commented 6 years ago

I am wondering if these two existing, but unaddressed, issues are related https://github.com/MycroftAI/padatious/issues/3 https://github.com/MycroftAI/padatious/issues/4

forslund commented 6 years ago

I've done some experimentation and I think there's some weirdness in adapt when two skills has similar regexes.

I get your example skill to work as intended if I blacklist the skill-date-time which has the following regex:

(at|in|for) (?P<Location>.*)

My current working theory is that this matches the substring and won't do any more matching.

Will keep digging...

clusterfudge commented 2 years ago

Sorry for the delayed response here! We've been working a bunch recently, and I believe your issues may have been addressed by #137 . I don't have a good setup for installing your example to test (but thank you for crafting it!), but perhaps @forslund does?

In the mean time, I'm going to mark this as "close on 9/17" in the interest of wrapping up our 1.0.0 version. It's been a few years, so I'm not expecting a response, but if you do, I'll be here!