Using pygtrie, how do you find all the words in some text that have been added to a trie?

23 Views Asked by At

If I have...

from pygtrie import Trie

trie = Trie()
trie["Grand Canyon"] = true
trie["New York"] = true

How do I search the trie such that it returns all the key names found in some text?

I would expect there to be something like...

matches = trie.find("Grand Canyon, New York, I like strawberries.")

... but I can't find it in the docs.

0

There are 0 best solutions below