nltk.Trie.insert

Trie.insert(string)[source]

Inserts string into the Trie

Parameters:string (str) – String to insert into the trie
Example:
>>> from nltk.util import Trie
>>> trie = Trie(["ab"])
>>> trie
defaultdict(<class 'nltk.util.Trie'>, {'a': defaultdict(<class 'nltk.util.Trie'>, {'b': defaultdict(<class 'nltk.util.Trie'>, {True: None})})})