I notice that the Trie behaves more like a set and its match method returns the match length. Would it be viable to make it behave like a map with its match returning the choice index (that can be kept as an additional field in the Info struct).
I think that would make for a more consistent interface. And allow for more performant grammar handling in certain cases.
I notice that the Trie behaves more like a set and its
match
method returns the match length. Would it be viable to make it behave like a map with itsmatch
returning the choice index (that can be kept as an additional field in theInfo
struct).I think that would make for a more consistent interface. And allow for more performant grammar handling in certain cases.