xatkit-runtime icon indicating copy to clipboard operation
xatkit-runtime copied to clipboard

Improve @any RegExp in DefaultIntentRecognitionProvider

Open gdaniel opened this issue 5 years ago • 0 comments

@any (and all the other system entities) are now mapped with "(\\S)+" (every sequence of non-space characters). This could be improved when the rest of the String to match is known, in order to support sequences of characters including spaces (and excepted the rest of the String). This is even the case when the end of the String is empty. In fact the only case where this shouldn't be the case is when two entities are following each other, but this is a bad practice anyway that cause issues in several recognition providers.

This may be tricky to implement as RegExp, especially when we consider multiple alternative inputs.

Example that can be improved: "My name is @any and I live in @city" should match the input "My name is John Doe and I live in Barcelona". Right now this is not the case because John Doe contains a space character.

Reported by @kwisath

gdaniel avatar Aug 25 '19 00:08 gdaniel