|
Pep 0.4 API Documentation | ||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.osu.ling.pep.Rule
public class Rule
Represents a production rule in a context-free grammar
.
Rules contain a single category
on the
left side
that produces the series of categories on
the right side
.
Rules are immutable and cannot be changed once instantiated.
Category
,
Grammar
Constructor Summary | |
---|---|
Rule(Category left,
Category... right)
Creates a new rule with the specified left side category and series of categories on the right side. |
Method Summary | |
---|---|
boolean |
equals(Object obj)
Tests whether this rule is equal to another, with the same left and right sides. |
Category |
getLeft()
Gets the left side category of this rule. |
Category[] |
getRight()
Gets the series of categories on the right side of this rule. |
int |
hashCode()
Compues a hash code for this rule based on its left and right side categories. |
boolean |
isPreterminal()
Tests whether this rule is a pre-terminal production rule. |
boolean |
isSingletonPreterminal()
Tests whether this rule is a pre-terminal with a right side of length 1 . |
String |
toString()
Gets a string representation of this rule. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Rule(Category left, Category... right)
left
- The left side (trigger) for this production rule.right
- The right side (productions) licensed for this rule's
left side.
IllegalArgumentException
- If
null
,null
category.Method Detail |
---|
public boolean equals(Object obj)
equals
in class Object
true
iff the specified object is an instance of
Rule
and its left and right sides are equal to this rule's
left and right sides.public Category getLeft()
public Category[] getRight()
public int hashCode()
hashCode
in class Object
public boolean isPreterminal()
terminal category
.
true
iff this rule's right side contains a
terminal category.public boolean isSingletonPreterminal()
1
.
isPreterminal()
,
getRight()
public String toString()
toString
in class Object
S -> NP VP
" for a rule with a left side
category of S
and a right side sequence
[NP, VP]
.Category.toString()
|
Pep: Pep is an Earley parser | ||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the overview file.