treeExtract {xegaDerivationTrees}R Documentation

Extracts the subtree at position pos in a derivation tree.

Description

treeExtract() returns the subtree at position pos in a derivation tree.

Usage

treeExtract(tree, node)

Arguments

tree

Derivation tree.

node

Attributed node.

Details

An attributed node is a list whose element node$Index contains an access function to the node. The access function is represented as a string with an executable R index expression. All what remains to be done, is

Value

Derivation tree.

See Also

Other Tree Operations: compatibleSubtrees(), treeInsert()

Examples

g<-compileBNF(booleanGrammar())
t1<-randomDerivationTree(g$Start, g)
t1anl<-treeANL(t1, g$ST)
n1<-chooseNode(t1anl$ANL)
st1<-treeExtract(t1, n1)
decodeCDT(st1, g$ST)
st2<-treeExtract(t1, chooseNode(t1anl$ANLa))
decodeCDT(st2, g$ST)


[Package xegaDerivationTrees version 1.0.0.0 Index]