public class ProbContextFreeGrammar extends ProbContextSensitiveGrammar implements ProbabilisticGrammar
CNFGRAMMAR, CONTEXT_FREE, CONTEXT_SENSITIVE, PROB_CONTEXT_FREE, REGULAR, rules, terminals, type, UNRESTRICTED, vars
Constructor and Description |
---|
ProbContextFreeGrammar() |
Modifier and Type | Method and Description |
---|---|
boolean |
addRule(Rule r)
Add a rule to the grammar's rule list if it passes
both the restrictions of the parent grammars (unrestricted and context-sens)
and this grammar's restrictions.
|
boolean |
addRules(java.util.List<Rule> ruleList)
Add a ruleList as the grammar's rule list if all rules in it pass
both the restrictions of the parent grammars (unrestricted and context-sens)
and this grammar's restrictions.
|
boolean |
leftDerivesRight(java.util.ArrayList<java.lang.String> lhs,
java.util.ArrayList<java.lang.String> rhs)
Test whether LHS -> RHS is a rule in the grammar.
|
boolean |
validRule(Rule r)
For a grammar rule to be valid in a context-free grammar,
all the restrictions of the parent grammars must hold, and the restriction
of the context-free grammar must hold.
|
addRules
isTerminal, isVariable, toString, updateVarsAndTerminals, updateVarsAndTerminals, validateRuleProbabilities
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
updateVarsAndTerminals, updateVarsAndTerminals, validateRuleProbabilities
public boolean addRules(java.util.List<Rule> ruleList)
addRules
in interface ProbabilisticGrammar
addRules
in class ProbUnrestrictedGrammar
public boolean addRule(Rule r)
addRule
in interface ProbabilisticGrammar
addRule
in class ProbContextSensitiveGrammar
public boolean validRule(Rule r)
validRule
in interface ProbabilisticGrammar
validRule
in class ProbContextSensitiveGrammar
r
- ( a rule )public boolean leftDerivesRight(java.util.ArrayList<java.lang.String> lhs, java.util.ArrayList<java.lang.String> rhs)
lhs
- rhs
-