data-named-0.2.0: Data types for named entities

Safe HaskellSafe-Inferred

Data.Named.Tree

Contents

Description

Working with NE trees and forests.

Synopsis

Combine with words

addWords :: Ord k => Forest k -> [k] -> Forest kSource

Combine the disjoint forest with the list of words. Discontinuities will be patched with no trace.

Span

data Span Source

Spanning of a tree.

Constructors

Span 

Fields

beg :: Int
 
end :: Int
 

Instances

leafSpan :: Int -> SpanSource

Make span for a leaf node.

(<>) :: Span -> Span -> SpanSource

Minimum span overlapping both input spans.

spanSet :: Span -> IntSetSource

Set of positions covered by the span.

Trees with span

span :: Tree (a, Span) -> SpanSource

Get span of the span-annotated tree.

spanTree :: (k -> Int) -> Tree k -> Tree (k, Span)Source

Annotate tree nodes with spanning info given the function which assignes indices to leaf nodes.

spanForest :: (k -> Int) -> Forest k -> Forest (k, Span)Source

Annotate forest nodes with spanning info.

unSpanTree :: Tree (k, Span) -> Tree kSource

Remove span annotations from the tree.

unSpanForest :: Forest (k, Span) -> Forest kSource

Remove span annotations from the forest.

sortTree :: Tree (k, Span) -> Tree (k, Span)Source

Sort the tree with respect to spanning info.

sortForest :: Forest (k, Span) -> Forest (k, Span)Source

Sort the forest with respect to spanning info.

Utilities

mapTrees :: (a -> b) -> Forest a -> Forest bSource

Map function over each tree from the forest.