data-named-0.3.0: Data types for named entities

Safe HaskellSafe-Inferred




Working with NE trees and forests.



data Span w Source

Spanning of a tree.




beg :: w
end :: w


Eq w => Eq (Span w) 
(Eq (Span w), Ord w) => Ord (Span w) 
Show w => Show (Span w) 

leafSpan :: w -> Span wSource

Make span for a leaf node.

(<>) :: Ord w => Span w -> Span w -> Span wSource

Minimum span overlapping both input spans.

spanSet :: Ix w => Span w -> Set wSource

Set of positions covered by the span.

Trees with span

span :: Tree (a, Span w) -> Span wSource

Get span of the span-annotated tree.

spanTree :: Ord w => Tree (Either n w) -> Tree (Either n w, Span w)Source

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

spanForest :: Ord w => Forest (Either n w) -> Forest (Either n w, Span w)Source

Annotate forest nodes with spanning info.

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

Remove span annotations from the tree.

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

Remove span annotations from the forest.

sortTree :: Ord w => Tree (k, Span w) -> Tree (k, Span w)Source

Sort the tree with respect to spanning info.

sortForest :: Ord w => Forest (k, Span w) -> Forest (k, Span w)Source

Sort the forest with respect to spanning info.


mapLeaves :: (a -> b) -> Tree (Either c a) -> Tree (Either c b)Source

Map function over tree leaves.

mapNodes :: (a -> b) -> Tree (Either a c) -> Tree (Either b c)Source

Map function over tree internal nodes.

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

Map function over each tree from the forest.