chooseNode {xegaDerivationTrees} | R Documentation |
Selects an attributed node in an attributed node list randomly.
Description
chooseNode()
returns a random attributed node
from an attributed node list
Usage
chooseNode(ANL)
Arguments
ANL |
Attributed node list. |
Details
An attributed node
has the following elements:
-
ID
-
NonTerminal
-
Pos
-
Depth
-
Rdepth
-
subtreedepth
-
node$Index
These elements can be used e.g.
for inserting and extracting subtrees (
Pos
ornode$Index
),for checking the feasibility of subtree substitution (
ID
),for checking depth bounds (
Depth
,RDepth
, andsubtreedepth
), ...
Value
Attributed node.
See Also
Other Random Choice:
chooseRule()
Examples
g<-compileBNF(booleanGrammar())
a<-randomDerivationTree(g$Start, g)
b<-treeANL(a, g$ST)
c<-chooseNode(b$ANL)
[Package xegaDerivationTrees version 1.0.0.0 Index]