Search in sources :

Example 6 with Sentence

use of com.hankcs.hanlp.corpus.document.sentence.Sentence in project HanLP by hankcs.

the class CorpusLoader method convert2SentenceList.

public static List<List<IWord>> convert2SentenceList(String path) {
    List<Document> documentList = CorpusLoader.convert2DocumentList(path);
    List<List<IWord>> simpleList = new LinkedList<List<IWord>>();
    for (Document document : documentList) {
        for (Sentence sentence : document.sentenceList) {
            simpleList.add(sentence.wordList);
        }
    }
    return simpleList;
}
Also used : List(java.util.List) LinkedList(java.util.LinkedList) Sentence(com.hankcs.hanlp.corpus.document.sentence.Sentence) LinkedList(java.util.LinkedList) IWord(com.hankcs.hanlp.corpus.document.sentence.word.IWord)

Aggregations

Sentence (com.hankcs.hanlp.corpus.document.sentence.Sentence)6 LinkedList (java.util.LinkedList)5 IWord (com.hankcs.hanlp.corpus.document.sentence.word.IWord)4 List (java.util.List)4 CompoundWord (com.hankcs.hanlp.corpus.document.sentence.word.CompoundWord)3 Word (com.hankcs.hanlp.corpus.document.sentence.word.Word)3 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1