edu.washington.cs.knowitall.nlp
Class ChunkedSentenceReader

java.lang.Object
  extended by edu.washington.cs.knowitall.nlp.ChunkedSentenceReader
All Implemented Interfaces:
Iterable<ChunkedSentence>

public class ChunkedSentenceReader
extends Object
implements Iterable<ChunkedSentence>

A class that combines a SentenceExtractor with a SentenceChunker to read NpChunkedSentence objects from a BufferedReader. This object uses the SentenceExtractor to obtain String sentences from the input, and then chunks the sentences using the SentenceChunker object.

Author:
afader

Constructor Summary
ChunkedSentenceReader(Reader r)
          Constructs a reader from r using the default SentenceExtractor and OpenNlpSentenceChunker.
ChunkedSentenceReader(Reader r, SentenceChunker sc)
          Constructs a reader from r using the chunker sc and the default SentenceExtractor.
ChunkedSentenceReader(Reader r, SentenceExtractor se)
          Constructs a reader from r using the sentence extractor se and the default OpenNlpSentenceChunker object.
ChunkedSentenceReader(Reader r, SentenceExtractor se, SentenceChunker sc)
          Constructs a reader from r using the sentence extractor se and the sentence chunker sc.
 
Method Summary
 void addFilter(com.google.common.base.Predicate<ChunkedSentence> filter)
          This filter is used for sentences AFTER they have been chunked.
 SentenceChunker getSentenceChunker()
           
 SentenceExtractor getSentenceExtractor()
           
 Iterable<ChunkedSentence> getSentences()
           
 ChunkedSentenceIterator iterator()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChunkedSentenceReader

public ChunkedSentenceReader(Reader r,
                             SentenceExtractor se)
                      throws IOException
Constructs a reader from r using the sentence extractor se and the default OpenNlpSentenceChunker object.

Parameters:
r -
se -
Throws:
IOException

ChunkedSentenceReader

public ChunkedSentenceReader(Reader r,
                             SentenceChunker sc)
                      throws IOException
Constructs a reader from r using the chunker sc and the default SentenceExtractor.

Parameters:
r -
sc -
Throws:
IOException

ChunkedSentenceReader

public ChunkedSentenceReader(Reader r)
                      throws IOException
Constructs a reader from r using the default SentenceExtractor and OpenNlpSentenceChunker.

Parameters:
r -
Throws:
IOException

ChunkedSentenceReader

public ChunkedSentenceReader(Reader r,
                             SentenceExtractor se,
                             SentenceChunker sc)
Constructs a reader from r using the sentence extractor se and the sentence chunker sc.

Parameters:
r -
se -
sc -
Method Detail

addFilter

public void addFilter(com.google.common.base.Predicate<ChunkedSentence> filter)
This filter is used for sentences AFTER they have been chunked.

Parameters:
filter -

getSentenceExtractor

public SentenceExtractor getSentenceExtractor()
Returns:
the object used to extract sentences from strings.

getSentenceChunker

public SentenceChunker getSentenceChunker()
Returns:
the object used to chunk sentences.

iterator

public ChunkedSentenceIterator iterator()
Specified by:
iterator in interface Iterable<ChunkedSentence>
Returns:
an iterator over the sentences from the BufferedReader given during construction.

getSentences

public Iterable<ChunkedSentence> getSentences()
Returns:
an iterable object over the sentences from the BufferedReader given during construction.


Copyright © 2010-2012 University of Washington CSE. All Rights Reserved.