Learn R Programming

xegaDerivationTrees (version 1.0.0.6)

treeProbability: The (path) probability of generating tree by grammar G.

Description

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.

Usage

treeProbability(tree, G)

Value

Real. The probability of generating tree

by grammar G.

Arguments

tree

Derivation tree.

G

A context-free grammar.

See Also

Other Measures of Tree Attributes: treeLeaves(), treeListDepth(), treeNodes(), treeSize()

Examples

Run this code
g<-compileBNF(booleanGrammar())
a<-randomDerivationTree(g$Start, g)
decodeTree(a, g$ST) 
treeProbability(tree=a, G=g)

Run the code above in your browser using DataLab