|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object opennlp.tools.parser.Parse
public class Parse
Data structure for holding parse constituents.
Field Summary | |
---|---|
static String |
BRACKET_LCB
|
static String |
BRACKET_LRB
|
static String |
BRACKET_RCB
|
static String |
BRACKET_RRB
|
Constructor Summary | |
---|---|
Parse(String text,
Span span,
String type,
double p,
int index)
Creates a new parse node for this specified text and span of the specified type with the specified probability and the specified head index. |
|
Parse(String text,
Span span,
String type,
double p,
Parse h)
Creates a new parse node for this specified text and span of the specified type with the specified probability and the specified head and head index. |
Method Summary | |
---|---|
void |
add(Parse daughter,
HeadRules rules)
|
static void |
addNames(String tag,
Span[] names,
Parse[] tokens)
Utility method to inserts named entities. |
void |
addNextPunctuation(Parse punct)
Designates that the specified punctuation follows this parse. |
void |
addPreviousPunctuation(Parse punct)
Designates that the specified punctuation should is prior to this parse. |
void |
addProb(double logProb)
Adds the specified probability log to this current log for this parse. |
Parse |
adjoin(Parse sister,
HeadRules rules)
Sister adjoins this node's last child and the specified sister node and returns their new parent node. |
Parse |
adjoinRoot(Parse node,
HeadRules rules,
int parseIndex)
|
Object |
clone()
|
Parse |
clone(Parse node)
Clones the right frontier of parse up to the specified node. |
Parse |
cloneRoot(Parse node,
int parseIndex)
Clones the right frontier of this root parse up to and including the specified node. |
int |
compareTo(Parse p)
|
boolean |
complete()
Returns whether this parse is complete. |
boolean |
equals(Object o)
|
void |
expandTopNode(Parse root)
|
static void |
fixPossesives(Parse parse)
|
int |
getChildCount()
Returns the number of children for this parse node. |
Parse[] |
getChildren()
Returns the child constituents of this constituent . |
Parse |
getCommonParent(Parse node)
Returns the deepest shared parent of this node and the specified node. |
StringBuffer |
getDerivation()
Returns the derivation string for this parse if one has been created. |
Parse |
getHead()
Returns the head constituent associated with this constituent. |
int |
getHeadIndex()
Returns the index within a sentence of the head token for this parse. |
String |
getLabel()
Returns the label assigned to this parse node during parsing which specifies how this node will be formed into a constituent. |
Collection<Parse> |
getNextPunctuationSet()
Returns the set of punctuation parses that occur immediately after this parse. |
Parse |
getParent()
Returns the parent parse node of this constituent. |
Collection<Parse> |
getPreviousPunctuationSet()
Returns the set of punctuation parses that occur immediately before this parse. |
double |
getProb()
Returns the log of the product of the probability associated with all the decisions which formed this constituent. |
Span |
getSpan()
Returns the character offsets for this constituent. |
Parse[] |
getTagNodes()
Returns the parse nodes which are children of this node and which are pos tags. |
double |
getTagSequenceProb()
Returns the probability associated with the pos-tag sequence assigned to this parse. |
String |
getText()
Returns the text of the sentence over which this parse was formed. |
String |
getType()
Returns the constituent label for this node of the parse. |
int |
hashCode()
|
int |
indexOf(Parse child)
Returns the index of this specified child. |
void |
insert(Parse constituent)
Inserts the specified constituent into this parse based on its text span.This method assumes that the specified constituent can be inserted into this parse. |
boolean |
isChunk()
|
void |
isChunk(boolean ic)
|
boolean |
isFlat()
Returns true if this constituent contains no sub-constituents. |
boolean |
isPosTag()
Indicates whether this parse node is a pos-tag. |
static void |
main(String[] args)
Deprecated. |
static Parse |
parseParse(String parse)
Parses the specified tree-bank style parse string and return a Parse structure for that string. |
static Parse |
parseParse(String parse,
GapLabeler gl)
Parses the specified tree-bank style parse string and return a Parse structure for that string. |
static void |
pruneParse(Parse parse)
Prune the specified sentence parse of vacuous productions. |
void |
remove(int index)
|
void |
setChild(int index,
String label)
Replaces the child at the specified index with a new child with the specified label. |
void |
setDerivation(StringBuffer derivation)
Specifies the derivation string to be associated with this parse. |
void |
setLabel(String label)
Assigns this parse the specified label. |
void |
setNextPunctuation(Collection<Parse> punctSet)
Sets the set of punctuation tags which follow this parse. |
void |
setParent(Parse parent)
Specifies the parent parse node for this constituent. |
void |
setPrevPunctuation(Collection<Parse> punctSet)
Sets the set of punctuation tags which preceed this parse. |
void |
setType(String type)
Set the type of this constituent to the specified type. |
void |
show()
Displays this parse using Penn Treebank-style formatting. |
void |
show(StringBuffer sb)
Appends the specified string buffer with a string representation of this parse. |
void |
showCodeTree()
Prints to standard out a representation of the specified parse which contains hash codes so that parent/child relationships can be explicitly seen. |
String |
toString()
|
void |
updateHeads(HeadRules rules)
Computes the head parses for this parse and its sub-parses and stores this information in the parse data structure. |
void |
updateSpan()
|
static void |
useFunctionTags(boolean uft)
Specifies whether function tags should be included as part of the constituent type. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String BRACKET_LRB
public static final String BRACKET_RRB
public static final String BRACKET_LCB
public static final String BRACKET_RCB
Constructor Detail |
---|
public Parse(String text, Span span, String type, double p, int index)
text
- The text of the sentence for which this node is a part of.span
- The character offsets for this node within the specified text.type
- The constituent label of this node.p
- The probability of this parse.index
- The token index of the head of this parse.public Parse(String text, Span span, String type, double p, Parse h)
text
- The text of the sentence for which this node is a part of.span
- The character offsets for this node within the specified text.type
- The constituent label of this node.p
- The probability of this parse.h
- The head token of this parse.Method Detail |
---|
public Object clone()
clone
in class Object
public Parse clone(Parse node)
node
- The last node in the right frontier of the parse tree which should be cloned.
public Parse cloneRoot(Parse node, int parseIndex)
node
- The last node in the right frontier of the parse tree which should be cloned.parseIndex
- The child index of the parse for this root node.
public static void useFunctionTags(boolean uft)
uft
- true is they should be included; false otherwise.public void setType(String type)
type
- The type of this constituent.public String getType()
public Collection<Parse> getPreviousPunctuationSet()
public void addPreviousPunctuation(Parse punct)
punct
- The punctuation.public Collection<Parse> getNextPunctuationSet()
public void addNextPunctuation(Parse punct)
punct
- The punctuation set.public void setNextPunctuation(Collection<Parse> punctSet)
punctSet
- The set of punctuation tags which follow this parse.public void setPrevPunctuation(Collection<Parse> punctSet)
punctSet
- The set of punctuation tags which preceed this parse.public void insert(Parse constituent)
constituent
- The constituent to be inserted.public void show(StringBuffer sb)
sb
- A string buffer into which the parse string can be appended.public void show()
public double getTagSequenceProb()
public boolean complete()
public String toString()
toString
in class Object
public String getText()
public Span getSpan()
public double getProb()
public void addProb(double logProb)
logProb
- The probability of an action performed on this parse.public Parse[] getChildren()
public void setChild(int index, String label)
index
- The index of the child to be replaced.label
- The label to be assigned to the new child.public void add(Parse daughter, HeadRules rules)
public void remove(int index)
public Parse adjoinRoot(Parse node, HeadRules rules, int parseIndex)
public Parse adjoin(Parse sister, HeadRules rules)
sister
- The node to be adjoined.rules
- The head rules for the parser.
public void expandTopNode(Parse root)
public int getChildCount()
public int indexOf(Parse child)
child
- A child of this parse.
public Parse getHead()
public int getHeadIndex()
public String getLabel()
public void setLabel(String label)
label
- A label indicating something about the stage of building for this parse node.public void updateHeads(HeadRules rules)
rules
- The head rules which determine how the head of the parse is computed.public void updateSpan()
public static void pruneParse(Parse parse)
parse
- public static void fixPossesives(Parse parse)
public static Parse parseParse(String parse)
parse
- A tree-bank style parse string.
public static Parse parseParse(String parse, GapLabeler gl)
parse
- A tree-bank style parse string.gl
- The gap labeler.
public Parse getParent()
public void setParent(Parse parent)
parent
- The parent parse node for this constituent.public boolean isPosTag()
public boolean isFlat()
public void isChunk(boolean ic)
public boolean isChunk()
public Parse[] getTagNodes()
public Parse getCommonParent(Parse node)
node
- The node from which parents are compared to this node's parents.
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public int compareTo(Parse p)
compareTo
in interface Comparable<Parse>
public StringBuffer getDerivation()
public void setDerivation(StringBuffer derivation)
derivation
- The derivation string to be associated with this parse.public void showCodeTree()
public static void addNames(String tag, Span[] names, Parse[] tokens)
tag
- names
- tokens
- @Deprecated public static void main(String[] args) throws IOException
args
- The head rules files.
IOException
- If the head rules file can not be opened and read.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |