dawg-0.3.0: Directed acyclic word graphs

Safe HaskellNone



The module provides a wrapper over the DAWG with separate Codec for values encoding, which is beneficial when the set of possible DAWG values is small but individual values occupy a lot of memory. NOTE: Useless values are not deleted from the codec when deleting the DAWG entry.



data DAWG a Source

A plain DAWG with separate Codec for values encoding.




dawg :: !(DAWG Int)
codec :: !(AtomCodec a)

empty :: DAWG aSource

Empty DAWG.

numStates :: DAWG a -> IntSource

Number of states in the underlying graph.

insert :: Ord a => String -> a -> DAWG a -> DAWG aSource

Insert the (key, value) pair into the DAWG.

delete :: Ord a => String -> DAWG a -> DAWG aSource

Delete the key from the DAWG.

lookup :: Ord a => String -> DAWG a -> Maybe aSource

Find value associated with the key.

fromList :: Ord a => [(String, a)] -> DAWG aSource

Construct DAWG from the list of (word, value) pairs.

fromLang :: [String] -> DAWG ()Source

Make DAWG from the list of words. Annotate each word with the () value.