treeProbability {xegaDerivationTrees}R Documentation

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)

Arguments

tree

Derivation tree.

G

A context-free grammar.

Value

Real. The probability of generating tree by grammar G.

See Also

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

Examples

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


[Package xegaDerivationTrees version 1.0.0.6 Index]