adict-0.3.0: Approximate dictionary searching

Safe HaskellNone

NLP.Adict.DAWG

Description

A directed acyclic word graph.

Synopsis

Documentation

data DAWG a b Source

A directed acyclic word graph with character type a and dictionary entry type b. Each node is represented by a unique integer number which is also an index of the node in the vector of DAWG nodes.

Constructors

DAWG 

Fields

root :: Int

Root (index) of the DAWG

nodes :: Vector (Node a b)

Vector of DAWG nodes

Instances

(Ord a, Binary a, Binary b) => Binary (DAWG a b) 

data Node a b Source

A node in the DAWG.

Constructors

Node 

Fields

valueIn :: b

Value in the node.

subNodes :: Vector (a, Int)

Edges to subnodes (represented by DAWG node indices) annotated with characters.

type DAWGM a b = DAWG a (Maybe b)Source

A DAWGM is a DAWG with Maybe values in nodes.

fromTrie :: (Ord a, Ord b) => Trie a b -> DAWG a bSource

Find and eliminate all common subtries in the input trie and return the trie represented as a DAWG.

fromDAWG :: Ord a => DAWG a b -> Trie a bSource

Transform the DAWG to implicit DAWG in a form of a trie.