Java Reference
In-Depth Information
This List instance of list class can be displayed in several ways. In the next sequence,
the toString method of the List class displays the list enclosed in brackets, with its
elements separated by commas:
for (List<CoreLabel> sent : sents) {
System.out.println(sent);
}
The output of this sequence produces the following:
[When, determining, the, end, of, sentences, we, need, to,
consider, several, factors, .]
[Sentences, may, end, with, exclamation, marks, !]
[Or, possibly, questions, marks, ?]
[Within, sentences, we, may, find, numbers, like, 3.14159,
,, abbreviations, such, as, found, in, Mr., Smith, ,, and,
possibly, ellipses, either, within, a, sentence, ..., ,,
or, at, the, end, of, a, sentence, ...]
An alternate approach shown here displays each sentence on a separate line:
for (List<CoreLabel> sent : sents) {
for (CoreLabel element : sent) {
System.out.print(element + " ");
}
System.out.println();
}
The output is as follows:
When determining the end of sentences we need to consider
several factors .
Sentences may end with exclamation marks !
Or possibly questions marks ?
Within sentences we may find numbers like 3.14159 ,
abbreviations such as found in Mr. Smith , and possibly
ellipses either within a sentence ... , or at the end of a
sentence ...
Search WWH ::




Custom Search