Safe Haskell | None |
---|
NLP.Adict.Trie
Description
A (prefix) trie.
- data Trie a b = Trie {}
- type TrieM a b = Trie a (Maybe b)
- empty :: Ord a => TrieM a b
- insert :: Ord a => [a] -> b -> TrieM a b -> TrieM a b
- fromList :: Ord a => [([a], b)] -> TrieM a b
- toList :: TrieM a b -> [([a], b)]
- follow :: Ord a => [a] -> Trie a b -> Maybe (Trie a b)
- lookup :: Ord a => [a] -> TrieM a b -> Maybe b
- fromLang :: Ord a => [[a]] -> TrieM a ()
- implicitDAWG :: (Ord a, Ord b) => Trie a b -> Trie a b
Documentation
A trie of words with character type a
and entry type b
.
It represents a Map
from [a]
keys to b
values.
Constructors
Trie | |
insert :: Ord a => [a] -> b -> TrieM a b -> TrieM a bSource
Insert word with the given value to the trie.
fromList :: Ord a => [([a], b)] -> TrieM a bSource
Construct the trie from the list of (word, value) pairs.
follow :: Ord a => [a] -> Trie a b -> Maybe (Trie a b)Source
Follow the path determined by the input word starting in the trie root.
lookup :: Ord a => [a] -> TrieM a b -> Maybe bSource
Search for the value assigned to the given word in the trie.