dawg-0.1.0: DAWG

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 (TODO:)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 a)
 
root :: !Id
 

Instances

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

empty :: DAWG aSource

Empty DAWG.

size :: DAWG a -> IntSource

DAWG size (number of nodes).

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

Insert the (key, value) pair into 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.