|
||||||||||
| 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 Annotations, each of which represents
an Annotation for each word in the sentence. These word level Annotations 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 DependencyTreeNodes or a
series of StringPairs.
| 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 ith token in the
Sentence. |
edu.ucla.sspace.dependency.DependencyTreeNode[] |
dependencyParseTree()
Returns an Iterator over DependencyTreeNodes 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 Annotations for each
token in the Sentence. |
int |
numTokens()
|
static List<Sentence> |
readSentences(String sentenceText,
String tokenText)
Reads a list of Sentences 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 StringPairs 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 ith 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 DependencyTreeNodes for each
token in the Sentence.
public StringPair[] taggedTokens()
Iterator over StringPairs for each
token in the Sentence.
public Iterator<edu.stanford.nlp.pipeline.Annotation> iterator()
Iterator over Annotations 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)
Sentences 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 | |||||||||