Open sunfangxun opened 4 years ago
It seems the matching strategy is greedy instead of optimal.
For example: _grammar = Grammar() play = AlternativeSet("play", "play the") something = AlternativeSet("the game", "piano") play_something = PublicRule("play_something", Sequence(play, something)) grammar.add_rules(playsomething) grammar.compile()
_grammar.find_matching_rules("play the game") -- no matching grammar.find_matchingrules("play the piano") -- matching
I think the sentance "play the game" should match the rule "play""the game".
Can you help to support it? Thanks.
@Danesprite
@sunfangxun Thanks for reporting this! I'll see if I can fix it soon.
It seems the matching strategy is greedy instead of optimal.
For example: _grammar = Grammar() play = AlternativeSet("play", "play the") something = AlternativeSet("the game", "piano") play_something = PublicRule("play_something", Sequence(play, something)) grammar.add_rules(playsomething) grammar.compile()
_grammar.find_matching_rules("play the game") -- no matching grammar.find_matchingrules("play the piano") -- matching
I think the sentance "play the game" should match the rule "play""the game".
Can you help to support it? Thanks.
@Danesprite