View source: R/derivationTrees.R
treeProbability | R Documentation |
tree
by grammar G
.treeProbability()
returns the path
probability of generating the derivation tree tree
by the context-free grammar G
.
The probability is exact, if the grammar is not ambiguous and
if the grammar does not contain redundant rules.
treeProbability(tree, G)
tree |
Derivation tree. |
G |
A context-free grammar. |
Real. The probability of generating tree
by grammar G
.
Other Measures of Tree Attributes:
treeLeaves()
,
treeListDepth()
,
treeNodes()
,
treeSize()
g<-compileBNF(booleanGrammar())
a<-randomDerivationTree(g$Start, g)
decodeTree(a, g$ST)
treeProbability(tree=a, G=g)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.