dawg-0.3.0: Directed acyclic word graphs

Safe HaskellNone

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.

Synopsis

Documentation

data DAWG a Source

A Graph with one root from which all other graph nodes should be accesible.

Constructors

DAWG 

Fields

graph :: !(Graph (Maybe a))
 
root :: !Id
 

Instances

Eq a => Eq (DAWG a) 
(Eq (DAWG a), Ord a) => Ord (DAWG a) 
Show a => Show (DAWG a) 
(Ord a, Binary a) => Binary (DAWG a) 

empty :: Ord a => 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 :: 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.