Closed ExplodingCabbage closed 8 years ago
I'm not sure it is possible to do what you want. These ids are internal, they depend on internal graph representation and not stored anywhere. Think of them like hashes, which values happen to be between 0 and len(trie)-1. It may be impossible to assing these IDs explicitly without making tries use much more memory. Creating a list or an array of a required length and then filling it is not too bad :)
See below:
This is inconvenient given that one possible use case, actually encouraged in the README, is to
Ideally I'd like to be able to loop over my elements in ID order to construct such a list. I guess I can create a list of the right length and then assign into it, but couldn't this be made easier (either by assigning IDs according to the order the words were passed to
Trie()
in, or by having iteration over the trie iterate in ID order?