|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.stanford.nlp.util.ArrayCoreMap
edu.stanford.nlp.pipeline.Annotation
gov.llnl.ontology.text.Sentence
public class Sentence
An Annotation
specificly designed for sentences. It represents a
sentence as an array of other Annotation
s, each of which represents
an Annotation
for each word in the sentence. These word level Annotation
s can contain values for dependency parsing features, token
features, and part of speech tags. If these features are available, the
Sentence
can be viewed as a series DependencyTreeNode
s or a
series of StringPair
s.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class edu.stanford.nlp.pipeline.Annotation |
---|
edu.stanford.nlp.pipeline.Annotation.OriginalStringPLAnnotation, edu.stanford.nlp.pipeline.Annotation.OriginalWordsPLAnnotation, edu.stanford.nlp.pipeline.Annotation.ParsePLAnnotation, edu.stanford.nlp.pipeline.Annotation.WordsPLAnnotation |
Nested classes/interfaces inherited from interface edu.stanford.nlp.util.TypesafeMap |
---|
edu.stanford.nlp.util.TypesafeMap.Key<BASE,VALUE> |
Constructor Summary | |
---|---|
Sentence(int start,
int end,
int numTokens)
Creates a new Sentence with the following initial attributes. |
Method Summary | |
---|---|
void |
addAnnotation(int index,
edu.stanford.nlp.pipeline.Annotation annotation)
Sets annotation as the data for the i th token in the
Sentence . |
edu.ucla.sspace.dependency.DependencyTreeNode[] |
dependencyParseTree()
Returns an Iterator over DependencyTreeNode s for each
token in the Sentence . |
int |
end()
Returns the end index of this sentence. |
edu.stanford.nlp.pipeline.Annotation |
getAnnotation(int index)
Returns the Annotation stored at index |
Iterator<edu.stanford.nlp.pipeline.Annotation> |
iterator()
Returns an Iterator over Annotation s for each
token in the Sentence . |
int |
numTokens()
|
static List<Sentence> |
readSentences(String sentenceText,
String tokenText)
Reads a list of Sentence s from the serialzied form of the Sentence meta-data and the Annotation meta-data for each token
in the sentence. |
String |
sentenceText()
Returns the raw text from the original document text for just the characters spanned by this Sentence . |
void |
setText(String text)
Sets the raw document text associated with this Sentence . |
edu.stanford.nlp.util.IntPair |
span()
Returns the IntPair recording the span of this Sentence . |
int |
start()
Returns the start index of this sentence. |
StringPair[] |
taggedTokens()
Returns an Iterator over StringPair s for each
token in the Sentence . |
static StringPair |
writeSentences(List<Sentence> sentences)
|
Methods inherited from class edu.stanford.nlp.pipeline.Annotation |
---|
copy, toString |
Methods inherited from class edu.stanford.nlp.util.ArrayCoreMap |
---|
compact, containsKey, equals, get, has, hashCode, keySet, remove, set, setCapacity, size, toShorterString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Sentence(int start, int end, int numTokens)
Sentence
with the following initial attributes.
numTokens
dictates how many tokens were found in this sentence
and cannot be modified.
Method Detail |
---|
public void setText(String text)
Sentence
. This
must be called before calling sentenceText()
.
public String sentenceText()
Sentence
.
public void addAnnotation(int index, edu.stanford.nlp.pipeline.Annotation annotation)
annotation
as the data for the i
th token in the
Sentence
.
public edu.stanford.nlp.pipeline.Annotation getAnnotation(int index)
Annotation
stored at index
public edu.ucla.sspace.dependency.DependencyTreeNode[] dependencyParseTree()
Iterator
over DependencyTreeNode
s for each
token in the Sentence
.
public StringPair[] taggedTokens()
Iterator
over StringPair
s for each
token in the Sentence
.
public Iterator<edu.stanford.nlp.pipeline.Annotation> iterator()
Iterator
over Annotation
s for each
token in the Sentence
.
iterator
in interface Iterable<edu.stanford.nlp.pipeline.Annotation>
public int start()
public int end()
public int numTokens()
public edu.stanford.nlp.util.IntPair span()
IntPair
recording the span of this Sentence
.
public static List<Sentence> readSentences(String sentenceText, String tokenText)
Sentence
s from the serialzied form of the Sentence
meta-data and the Annotation
meta-data for each token
in the sentence. This will leave text
unset. Only output from
#writeSentence
is valid when calling readSentences(java.lang.String, java.lang.String)
.
public static StringPair writeSentences(List<Sentence> sentences)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |