|
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 edu.osu.ling.pep.DottedRule
public class DottedRule
Extension of Rule
that maintains a dot position within the
rule.
Dotted rules are used by Earley parsers
to keep
track of how far within a rule processing has succeeded. In a dotted rule,
the active category
is the first
category after the dot position
, and is
null
when processing has fully covered the underlying rule.
Edges
test the active category of dotted rules to determine
when an edge is active or passive.
Rule
,
Edge
Constructor Summary | |
---|---|
DottedRule(Rule rule)
Creates a new dotted rule for the given rule, with a dot position at the beginning of the rule's right side (position 0 ). |
|
DottedRule(Rule rule,
int position)
Creates a dotted rule maintaining the dot position within the right side category sequence of the underlying rule. |
Method Summary | |
---|---|
static DottedRule |
advanceDot(DottedRule dottedRule)
Creates and returns a new dotted rule exactly like the one provided except that its dot position is advanced by
1 . |
boolean |
equals(Object obj)
Tests whether this dotted rule is equal to another dotted rule by comparing their underlying rules and dot positions. |
Category |
getActiveCategory()
Gets the active category in the underlying rule, if any. |
int |
getPosition()
Gets the dot position within the underlying rule's right side category sequence . |
int |
hashCode()
Computes a hash code for this dotted rule based on its underlying rule and dot position. |
static DottedRule |
startRule(Category seed)
Creates a new start rule for a given seed category. |
String |
toString()
Gets a string representation of this dotted rule. |
Methods inherited from class edu.osu.ling.pep.Rule |
---|
getLeft, getRight, isPreterminal, isSingletonPreterminal |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DottedRule(Rule rule)
0
).
DottedRule(Rule, int)
public DottedRule(Rule rule, int position)
rule
- The underlying rule.position
- The zero-based position within rule
right
side categories where this dotted rule's dot is maintained.
IndexOutOfBoundsException
- If position < 0
or
position
is greater than the length of the
right side sequence
in rule
.Method Detail |
---|
public static DottedRule advanceDot(DottedRule dottedRule)
dot position
is advanced by
1
.
dottedRule
- The dotted rule whose dot position should be advanced.
IndexOutOfBoundsException
- If thw dotted rule's dot position
is already at the end of its right side.DottedRule(Rule, int)
public boolean equals(Object obj)
equals
in class Rule
true
iff the specified object is an instance of
DottedRule
and its underlying rule and position are equal
to this dotted rule's rule and position.Rule.equals(Object)
public Category getActiveCategory()
dot position
in the underlying rule's
right side category sequence
. If this rule's
dot position is already at the end of the right side category sequence,
returns null
.public int getPosition()
right side category sequence
.
public int hashCode()
hashCode
in class Rule
Rule.hashCode()
public static DottedRule startRule(Category seed)
seed
- The seed category to use.
special start
rule
on the left
and the specified seed
on the right
. This method is used by Earley parsers
for seeding.
NullPointerException
- If the seed category is null
.
IllegalArgumentException
- If the seed category is a
terminal
.Category.START
,
EarleyParser.parse(Iterable, Category)
public String toString()
toString
in class Rule
S -> NP * VP
" for a dotted rule with
an underlying rule S -> NP VP
and a dot position
1
.Rule.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.