|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jscience.ml.tigerxml.Sentence
public class Sentence
Represents a sentence in a corpus.
Sentence objects hold a list of NTs and a list of Ts. They also
provide methods for traversing the syntax tree, accessing nodes directly,
and getting other structural information.
GraphNode,
NT,
T,
Serialized Form| Constructor Summary | |
|---|---|
Sentence()
Creates a new Sentence instance setting all member variables to null or empty. |
|
Sentence(org.w3c.dom.Element sElement,
Corpus corpus)
Creates a new Sentence instance extracting all necessary information from the passed DOM Element. |
|
Sentence(org.w3c.dom.Element sElement,
Corpus corpus,
int verbosity)
Creates a new Sentence instance extracting all necessary information from the passed DOM Element. |
|
| Method Summary | |
|---|---|
void |
addNT(NT newnt)
|
void |
addT(T newt)
|
void |
addVNode(VNode v_node)
|
boolean |
equals(java.lang.Object obj)
Returns true if the object is identical to this Sentence
object. |
java.util.ArrayList |
getAllGraphNodes()
Returns all GraphNode objects contained in this sentence. |
GraphNode |
getById(java.lang.String pass_id)
Finds and returns a GraphNode in this sentence or returns
null if there is no GraphNode with the given ID. |
Corpus |
getCorpus()
Returns the corpus this sentence is part of. |
GraphNode |
getGraphNode(java.lang.String id)
Returns the GraphNode which has the given ID. |
java.lang.String |
getId()
|
int |
getIndex()
Returns the position index of this sentence in the corpus holding it. |
Sentence |
getNextSentence()
Returns the sentence object succeeding this sentence in the sentences ArrayList of the corpus containing this sentence. |
Sentence |
getNextSentence(int n)
Returns the sentence object succeeding this sentence in the sentences ArrayList of the corpus containing this sentence by n. |
int |
getNoOfNTs()
Deprecated. As of org.jscience.ml.tigerxml 1.1 - use getNTCount() instead. |
int |
getNoOfTs()
Deprecated. As of org.jscience.ml.tigerxml 1.1 - use getTCount() instead. |
NT |
getNT(int i)
|
NT |
getNT(java.lang.String id)
Returns the NT which has the given ID. |
int |
getNTCount()
Returns the number of NT objects in the sentence. |
java.util.ArrayList |
getNTs()
|
Sentence |
getPrevSentence()
Returns the sentence object predecessing this sentence in the sentences ArrayList of the corpus containing this sentence. |
Sentence |
getPrevSentence(int n)
Returns the sentence object predecessing this sentence in the sentences ArrayList of the corpus containing this sentence by n. |
NT |
getRootNT()
Returns the root node of the sentence (always an NT). |
java.lang.String |
getSpan()
Returns the MMAX-style span of the sentence. |
T |
getT(int i)
|
T |
getT(java.lang.String id)
Returns the T which has the given ID. |
int |
getTCount()
Returns the number of T objects in the sentence. |
T |
getTerminal(java.lang.String id)
Returns the T which has the given ID. |
java.util.ArrayList |
getTerminals()
Returns all terminal daughters. |
java.lang.String |
getText()
|
java.util.ArrayList |
getTs()
|
int |
getVerbosity()
Gets the currently set level of verbosity of this instance. |
VNode |
getVNode(java.lang.String v_node_id)
|
NT |
getVROOT()
Returns the VROOT of this sentence. |
int |
hashCode()
|
boolean |
hasRootNT()
|
boolean |
hasVNode(java.lang.String v_node_id)
|
protected void |
print2Xml(java.io.FileWriter out_xml)
|
void |
printTree()
Prints the syntax tree structure of this sentence to stout. |
void |
printTreeErr()
Prints the syntax tree structure of this sentence to stderr. |
void |
setCorpus(Corpus passCorpus)
Sets the corpus this sentence is part of. |
void |
setId(java.lang.String newid)
|
void |
setIndex(int index)
Sets the position index in the corpus holding this sentence. |
void |
setVerbosity(int verbosity)
Sets the currently set level of verbosity of this instance. |
java.lang.String |
toString()
Returns the String representation of this Sentence - its ID. |
java.lang.String |
toTreeString()
Returns the syntax tree structure of this sentence as as string. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Sentence()
null or empty.
public Sentence(org.w3c.dom.Element sElement,
Corpus corpus)
sElement - The DOM Sentence Element.corpus - The Corpus this Sentence is part of.
public Sentence(org.w3c.dom.Element sElement,
Corpus corpus,
int verbosity)
sElement - The DOM Sentence Element.corpus - The Corpus this Sentence is part of.| Method Detail |
|---|
public java.lang.String getId()
public void setId(java.lang.String newid)
public int getIndex()
public void setIndex(int index)
public Corpus getCorpus()
public void setCorpus(Corpus passCorpus)
public Sentence getNextSentence()
public Sentence getPrevSentence()
public Sentence getNextSentence(int n)
public Sentence getPrevSentence(int n)
public java.lang.String getSpan()
public int getNTCount()
public int getNoOfNTs()
getNTCount() instead.
integer denoting the number of non-terminals in
this sentence.public NT getNT(int i)
public NT getNT(java.lang.String id)
NT which has the given ID. Returns null if the
search fails. If the sentence of the NT is not known,
Corpus#getNT(Stringid) can be used to retrieve the
wanted NT.
id - The ID of the NT to be found.
null if the search
fails.public T getT(java.lang.String id)
T which has the given ID. Returns null if the
search fails. If the sentence of the T is not known,
Corpus#getT(Stringid) can be used to retrieve the
wanted T.
id - The ID of the T to be found.
null if the search
fails.public GraphNode getGraphNode(java.lang.String id)
GraphNode which has the given ID. Returns null if
the search fails. If the sentence of the GraphNode is
not known, Corpus#getGraphNode(Stringid) can be used to retrieve
the wanted GraphNode.
id - The ID of the GraphNode to be found.
GraphNode that is identified by ID or
null if the search fails.public java.util.ArrayList getAllGraphNodes()
GraphNode objects contained in this sentence. The
returned GraphNodes are in the order of the XML corpus file. In order
to have the list ordered by linear precedence, use
org.jscience.ml.tigerxml.tools.GeneralTools#sortNodes(ArrayListnodes).
The returned list does not contain the VROOT.
Ordering by class:
All NT objects of the sentence are followed by all
T object of the corpus.
Sentence.public T getTerminal(java.lang.String id)
T which has the given ID. Returns null if the
search fails. If the sentence of the T is not known,
Corpus#getTerminal(Stringid) can be used to retrieve the
wanted T.
id - The ID of the T to be found.
null if the search
fails.public java.util.ArrayList getNTs()
public java.util.ArrayList getTs()
public void addNT(NT newnt)
public NT getRootNT()
null if sth. goes wrong.public NT getVROOT()
public boolean hasRootNT()
public int getTCount()
public int getNoOfTs()
getTCount() instead.
public T getT(int i)
public void addT(T newt)
public java.lang.String getText()
public java.util.ArrayList getTerminals()
public java.lang.String toTreeString()
public void printTree()
public void printTreeErr()
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
Sentence
object. Identity is determined by comparing the sentence IDs.
equals in class java.lang.Objectobj - The Java Object to which this is to be
compared to.
getId()public int hashCode()
hashCode in class java.lang.Objectpublic GraphNode getById(java.lang.String pass_id)
GraphNode in this sentence or returns
null if there is no GraphNode with the given ID.
pass_id - The ID of the GraphNode to be found.
GraphNode with the given ID or null.public void addVNode(VNode v_node)
public boolean hasVNode(java.lang.String v_node_id)
public VNode getVNode(java.lang.String v_node_id)
protected void print2Xml(java.io.FileWriter out_xml)
public int getVerbosity()
public void setVerbosity(int verbosity)
verbosity - The level of verbosity.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||