partage-0.1.0.1: Parsing factorized

Safe HaskellSafe
LanguageHaskell2010

NLP.Partage.Tree.Other

Contents

Description

Alternative (to NLP.Partage.Tree) representation of TAG trees, in which information about the foot is present in the tree itself.

Synopsis

TAG Tree

type Tree n t = Tree (Node n t) Source

An initial or auxiliary TAG tree. Note that the type doesn't ensure that the foot is placed in a leaf, nor that there is at most one foot node. On the other hand, and in contrast to NLP.Partage.Tree, information about the foot is available at the level of the corresponding foot node.

data Node n t Source

Node of a TAG tree.

Constructors

NonTerm n

Standard non-terminal

Foot n

Foot non-terminal

Term t

Terminal

Instances

(Eq n, Eq t) => Eq (Node n t) Source 
(Ord n, Ord t) => Ord (Node n t) Source 
(Show n, Show t) => Show (Node n t) Source 

Base representation

type SomeTree n t = Either (Tree n t) (AuxTree n t) Source

An original tree representation (see NLP.Partage.Tree).

Conversion

encode :: SomeTree n t -> Tree n t Source

Encode the tree using the alternative representation.

decode :: Tree n t -> SomeTree n t Source

Decode the tree represented with the alternative representation.

Utils

isTerm :: Node n t -> Bool Source

Is it a teminal?

isFinal :: Tree n t -> Bool Source

Is it a final tree (i.e. does it contain only terminals in its leaves)?

isInitial :: Tree n t -> Bool Source

Is it an initial (i.e. non-auxiliary) tree?

isAuxiliary :: Tree n t -> Bool Source

Is it an auxiliary (i.e. with a foot) tree?

hasRoot :: Eq n => n -> Tree n t -> Bool Source

Is it a root label of the given tree?

project :: Tree n t -> [t] Source

Projection of a tree, i.e. a list of its terminals.