Safe Haskell | None |
---|---|
Language | Haskell2010 |
A version of Data.DAWG.Int adapted to keys and values with
Ord
instances.
- data DAWG a b
- type ID = Int
- root :: DAWG a b -> ID
- lookup :: Ord a => [a] -> DAWG a b -> Maybe b
- numStates :: DAWG a b -> Int
- numEdges :: DAWG a b -> Int
- value :: ID -> DAWG a b -> Maybe b
- edges :: ID -> DAWG a b -> [(a, ID)]
- follow :: Ord a => ID -> a -> DAWG a b -> Maybe ID
- empty :: DAWG a b
- fromList :: (Ord a, Ord b) => [([a], b)] -> DAWG a b
- fromLang :: Ord a => [[a]] -> DAWG a ()
- insert :: (Ord a, Ord b) => [a] -> b -> DAWG a b -> DAWG a b
- assocs :: DAWG a b -> [([a], b)]
- keys :: DAWG a b -> [[a]]
- elems :: DAWG a b -> [b]
DAWG type
A directed acyclic word graph (DAWG) with type a
representing
the type of alphabet symbols (over which keys are constructed)
and type b
-- the type of values.
A DAWG can be seen as a map from keys (sequences of a
's) to
values b
.
Query
Traversal
follow :: Ord a => ID -> a -> DAWG a b -> Maybe ID Source #
Follow a transition with the given symbol from the given state.
Construction
fromList :: (Ord a, Ord b) => [([a], b)] -> DAWG a b Source #
Construct DAWG from the list of (key, value) pairs.
fromLang :: Ord a => [[a]] -> DAWG a () Source #
Make DAWG from the list of words (annotate each word with
the ()
value).
Insertion
insert :: (Ord a, Ord b) => [a] -> b -> DAWG a b -> DAWG a b Source #
Insert the (key, value) pair into the DAWG.