Safe Haskell | None |
---|

The module implements *directed acyclic word graphs* (DAWGs) internaly
represented as *minimal acyclic deterministic finite-state automata*.

In comparison to Data.DAWG module the automaton implemented here:

- type DAWG a b = Vector (Node (Maybe b))
- lookup :: Enum a => [a] -> DAWG a b -> Maybe b
- numStates :: DAWG a b -> Int
- index :: Enum a => [a] -> DAWG a b -> Maybe Int
- byIndex :: Enum a => Int -> DAWG a b -> Maybe [a]
- hash :: Enum a => [a] -> DAWG a b -> Maybe Int
- unHash :: Enum a => Int -> DAWG a b -> Maybe [a]
- empty :: DAWG a b
- fromList :: (Enum a, Ord b) => [([a], b)] -> DAWG a b
- fromListWith :: (Enum a, Ord b) => (b -> b -> b) -> [([a], b)] -> DAWG a b
- fromLang :: Enum a => [[a]] -> DAWG a ()
- assocs :: Enum a => DAWG a b -> [([a], b)]
- keys :: Enum a => DAWG a b -> [[a]]
- elems :: DAWG a b -> [b]
- freeze :: DAWG a b -> DAWG a b

# DAWG type

# Query

# Index

index :: Enum a => [a] -> DAWG a b -> Maybe IntSource

Position in a set of all dictionary entries with respect to the lexicographic order.

byIndex :: Enum a => Int -> DAWG a b -> Maybe [a]Source

Find dictionary entry given its index with respect to the lexicographic order.

## Hashing

hash :: Enum a => [a] -> DAWG a b -> Maybe IntSource

Perfect hashing function for dictionary entries.
A synonym for the `index`

function.

# Construction

fromListWith :: (Enum a, Ord b) => (b -> b -> b) -> [([a], b)] -> DAWG a bSource