added Trie that could be used for Bernoulli model