partage-0.1.0.1: Parsing factorized

Safe HaskellSafe
LanguageHaskell2010

NLP.Partage.Tree

Contents

Description

This module provides datatypes representing TAG trees. Tree is an initial tree, while AuxTree represents an auxiliary tree.

Synopsis

Initial tree

data Tree a b Source

A tree with values of type a (non-termianls) kept in branching nodes, and values of type b (terminals) kept in leaf nodes

Constructors

Branch

Branching node with a non-terminal symbol

Fields

labelI :: a

The non-terminal kept in the branching node

subTrees :: [Tree a b]

The list of subtrees

Leaf

Leaf node with a terminal symbol

Fields

labelF :: b

The terminal symbol

Instances

(Eq a, Eq b) => Eq (Tree a b) Source 
(Ord a, Ord b) => Ord (Tree a b) Source 
(Show a, Show b) => Show (Tree a b) Source 

project :: Tree a b -> [b] Source

Projection of a tree: the list of terminal symbols in its leaves

Auxiliary tree

data AuxTree a b Source

An auxiliary tree

Constructors

AuxTree 

Fields

auxTree :: Tree a b

The underlying initial tree

auxFoot :: Path

The path to the foot node. Beware that currently it is possible to use the AuxTree constructor to build an invalid auxiliary tree, i.e. with an incorrect auxFoot value.

Instances

(Eq a, Eq b) => Eq (AuxTree a b) Source 
(Ord a, Ord b) => Ord (AuxTree a b) Source 
(Show a, Show b) => Show (AuxTree a b) Source 

Path

type Path = [Int] Source

A path indicates a particular node in a tree and can be used to extract a particular subtree of the tree (see follow). For instance, [] designates the entire tree, [0] the first child, and [1,3] the fourth child of the second child of the underlying tree.

follow :: Path -> Tree a b -> Maybe (Tree a b) Source

Follow the path to a particular subtree.