|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.stanford.nlp.trees.Constituent
public abstract class Constituent
A Constituent object defines a generic edge in a graph.
The Constituent class is designed to be extended. It
implements the Comparable interface in order to allow
graphs to be topologically sorted by the ordinary Collection
library in java.util, keying primarily on right-hand
node ID number. The Constituent class implements most
of the functionality of the the Label
interface by passing all requests down to the Label which
might be contained in the Constituent. This allows one
to put a Constituent anywhere that a Label is
required. A Constituent is always Scored.
| Constructor Summary | |
|---|---|
Constituent()
|
|
| Method Summary | |
|---|---|
boolean |
contains(Constituent c)
Detects whether this constituent contains a constituent, that is whether they are nested. |
boolean |
crosses(Collection constColl)
Detects whether this constituent overlaps any of a Collection of Constituents without nesting, that is, whether it "crosses" any of them. |
boolean |
crosses(Constituent c)
Detects whether this constituent overlaps a constituent without nesting, that is, whether they "cross". |
abstract int |
end()
access end node. |
boolean |
equals(Object obj)
Compare with another Object for equality. |
int |
hashCode()
A hashCode for Constituents done by shifting and or'ing for speed. |
Label |
label()
access label |
Collection |
labels()
Access labels -- actually always a singleton here. |
double |
score()
access score |
abstract void |
setEnd(int end)
set end node. |
void |
setFromString(String labelStr)
Make a new label with this String as the "name", perhaps
by doing some appropriate decoding of the string. |
void |
setLabel(Label label)
Sets the label associated with the current Constituent, if there is one. |
void |
setLabels(Collection labels)
Sets the labels associated with this object. |
void |
setScore(double score)
Sets the score associated with the current node, if there is one |
abstract void |
setStart(int start)
set start node. |
void |
setValue(String value)
Set the value for the label (if one is stored). |
int |
size()
Return the length of a Constituent |
abstract int |
start()
access start node. |
String |
toSentenceString(Sentence s)
Print out as a string the subpart of a sentence covered by this Constituent. |
String |
toString()
Return a string representation of a Constituent. |
String |
value()
Return the value of the label (or null if none). |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface edu.stanford.nlp.ling.Label |
|---|
labelFactory |
| Constructor Detail |
|---|
public Constituent()
| Method Detail |
|---|
public abstract int start()
public abstract void setStart(int start)
public abstract int end()
public abstract void setEnd(int end)
public Label label()
label in interface Labeledpublic void setLabel(Label label)
setLabel in interface Labeledlabel - The Label valuepublic Collection labels()
labels in interface Labeledpublic void setLabels(Collection labels)
Labeled
setLabels in interface Labeledlabels - The set of Label valuespublic double score()
score in interface Scoredpublic void setScore(double score)
public String toString()
Constituent.
toString in interface LabeltoString in class Objectpublic int size()
Constituent
public boolean equals(Object obj)
double NaN values are considered unequal in
Java.)
The general contract of equals() implies that one can't have a
subclass of a concrete [non-abstract] class redefine equals() to use
extra aspects, so subclasses shouldn't override this in ways that
make use of extra fields.
equals in class Objectobj - The object being compared with
public int hashCode()
hashCode in class Objectpublic boolean crosses(Constituent c)
c - The constituent to check against
public boolean crosses(Collection constColl)
constColl - The set of constituent to check against
ClassCastException - If some member of the Collection isn't
a Constituentpublic boolean contains(Constituent c)
c - The constituent to check against
public String value()
value in interface Labelpublic void setValue(String value)
setValue in interface Labelvalue - The value for the labelpublic void setFromString(String labelStr)
String as the "name", perhaps
by doing some appropriate decoding of the string.
setFromString in interface LabellabelStr - the String that translates into the content of the
labelpublic String toSentenceString(Sentence s)
Constituent.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||