|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.stanford.nlp.ling.Sentence
public class Sentence
Sentence holds a couple utility methods for lists. Those include a method that nicely prints a list and methods that construct lists of words from lists of strings.
| Method Summary | ||
|---|---|---|
static
|
extractNgram(java.util.List<T> list,
int start,
int end)
Returns the substring of the sentence from start (inclusive) to end (exclusive). |
|
static
|
listToString(java.util.List<T> list)
Returns the sentence as a string with a space between words. |
|
static
|
listToString(java.util.List<T> list,
boolean justValue)
Returns the sentence as a string with a space between words. |
|
static
|
listToString(java.util.List<T> list,
boolean justValue,
java.lang.String separator)
As already described, but if separator is not null, then objects such as TaggedWord |
|
static java.util.List<CoreLabel> |
toCoreLabelList(java.lang.String... words)
|
|
static java.util.ArrayList<TaggedWord> |
toTaggedList(java.util.List<java.lang.String> lex,
java.util.List<java.lang.String> tags)
Create an ArrayList as a list of TaggedWord from two
lists of String, one for the words, and the second for
the tags. |
|
static java.util.ArrayList<Word> |
toUntaggedList(java.util.List<java.lang.String> lex)
Create an ArrayList as a list of Word from a
list of String. |
|
static java.util.ArrayList<Word> |
toUntaggedList(java.lang.String... words)
Create a Sentence as a list of Word objects from
an array of String objects. |
|
static java.util.List<HasWord> |
toWordList(java.util.List<java.lang.String> lex)
|
|
static java.util.List<HasWord> |
toWordList(java.lang.String... words)
|
|
static
|
wordToString(T o,
boolean justValue)
|
|
static
|
wordToString(T o,
boolean justValue,
java.lang.String separator)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static java.util.ArrayList<TaggedWord> toTaggedList(java.util.List<java.lang.String> lex,
java.util.List<java.lang.String> tags)
TaggedWord from two
lists of String, one for the words, and the second for
the tags.
lex - a list whose items are of type String and
are the wordstags - a list whose items are of type String and
are the tags
public static java.util.ArrayList<Word> toUntaggedList(java.util.List<java.lang.String> lex)
Word from a
list of String.
lex - a list whose items are of type String and
are the words
public static java.util.List<HasWord> toWordList(java.util.List<java.lang.String> lex)
public static java.util.ArrayList<Word> toUntaggedList(java.lang.String... words)
Word objects from
an array of String objects.
words - The words to make it from
public static java.util.List<HasWord> toWordList(java.lang.String... words)
public static java.util.List<CoreLabel> toCoreLabelList(java.lang.String... words)
public static <T> java.lang.String listToString(java.util.List<T> list)
value() of each item -
this will give the expected answer for a shortform representation
of the "sentence" over a range of cases. It is equivalent to
calling toString(true)
TODO: Sentence used to be a subclass of ArrayList, with this
method as the toString. Therefore, there may be instances of
ArrayList being printed that expect this method to be used.
public static <T> java.lang.String listToString(java.util.List<T> list,
boolean justValue)
justValue - If true and the elements are of type
Label, return just the
value() of the Label of each word;
otherwise,
call the toString() method on each item.
public static <T> java.lang.String listToString(java.util.List<T> list,
boolean justValue,
java.lang.String separator)
separator - The string used to separate Word and Tag
in TaggedWord, etc
public static <T> java.lang.String wordToString(T o,
boolean justValue)
public static <T> java.lang.String wordToString(T o,
boolean justValue,
java.lang.String separator)
public static <T> java.lang.String extractNgram(java.util.List<T> list,
int start,
int end)
start - Leftmost index of the substringend - Rightmost index of the ngram
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||