pyjsgf icon indicating copy to clipboard operation
pyjsgf copied to clipboard

Greedy match or optimal match?

Open sunfangxun opened this issue 5 years ago • 1 comments

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(play_something) grammar.compile()

grammar.find_matching_rules("play the game") -- no matching grammar.find_matching_rules("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 avatar Nov 28 '19 12:11 sunfangxun

@sunfangxun Thanks for reporting this! I'll see if I can fix it soon.

drmfinlay avatar Dec 06 '19 02:12 drmfinlay