| Safe Haskell | None |
|---|
Data.DAWG
Description
The module provides implementation of directed acyclic word graphs (DAWGs) also known as minimal acyclic finite-state automata. The implementation provides fast insert and delete operations which can be used to build the DAWG structure incrementaly.
- data DAWG a = DAWG {}
- empty :: Ord a => DAWG a
- numStates :: DAWG a -> Int
- insert :: Ord a => String -> a -> DAWG a -> DAWG a
- insertWith :: Ord a => (a -> a -> a) -> String -> a -> DAWG a -> DAWG a
- delete :: Ord a => String -> DAWG a -> DAWG a
- lookup :: String -> DAWG a -> Maybe a
- fromList :: Ord a => [(String, a)] -> DAWG a
- fromListWith :: Ord a => (a -> a -> a) -> [(String, a)] -> DAWG a
- fromLang :: [String] -> DAWG ()
Documentation
A Graph with one root from which all other graph nodes should
be accesible.
insertWith :: Ord a => (a -> a -> a) -> String -> a -> DAWG a -> DAWG aSource
Insert with a function, combining new value and old value.
insertWith f key value d will insert the pair (key, value) into d if
key does not exist in the DAWG. If the key does exist, the function
will insert the pair (key, f new_value old_value).
fromList :: Ord a => [(String, a)] -> DAWG aSource
Construct DAWG from the list of (word, value) pairs.
fromListWith :: Ord a => (a -> a -> a) -> [(String, a)] -> DAWG aSource
Construct DAWG from the list of (word, value) pairs with a combining function. The combining function is applied strictly.