edu.washington.cs.knowitall.nlp
Class OpenNlpSentenceChunker

java.lang.Object
  extended by edu.washington.cs.knowitall.nlp.OpenNlpSentenceChunker
All Implemented Interfaces:
SentenceChunker

public class OpenNlpSentenceChunker
extends java.lang.Object
implements SentenceChunker

A class that combines OpenNLP tokenizer, POS tagger, and chunker objects into a single object that converts String sentences to NpChunkedSentence objects. By default, uses the models from DefaultObjects.getDefaultTokenizer(), DefaultObjects.getDefaultPosTagger(), and DefaultObjects.getDefaultChunker().

Author:
afader

Constructor Summary
OpenNlpSentenceChunker()
          Constructs a new OpenNlpSentenceChunker object using the default models from DefaultObjects.
OpenNlpSentenceChunker(opennlp.tools.tokenize.Tokenizer tokenizer, opennlp.tools.postag.POSTagger posTagger, opennlp.tools.chunker.Chunker chunker)
          Constructs a new OpenNlpSentenceChunker object using the provided OpenNLP objects.
 
Method Summary
 boolean attachOfs()
           
 void attachOfs(boolean attachOfs)
           
 boolean attachPossessives()
           
 void attachPossessives(boolean attachPossessives)
           
 ChunkedSentence chunkSentence(java.lang.String sent)
           
 OpenNlpSentenceChunkerStats lastChunkedSentenceStats()
          Returns statistics about the last call to chunkSentence or null.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OpenNlpSentenceChunker

public OpenNlpSentenceChunker()
                       throws java.io.IOException
Constructs a new OpenNlpSentenceChunker object using the default models from DefaultObjects.

Throws:
java.io.IOException - if unable to load the models.

OpenNlpSentenceChunker

public OpenNlpSentenceChunker(opennlp.tools.tokenize.Tokenizer tokenizer,
                              opennlp.tools.postag.POSTagger posTagger,
                              opennlp.tools.chunker.Chunker chunker)
Constructs a new OpenNlpSentenceChunker object using the provided OpenNLP objects.

Parameters:
tokenizer -
posTagger -
chunker -
Method Detail

attachOfs

public boolean attachOfs()
Returns:
true if this object will attach NPs beginning with "of" with the previous NP.

attachPossessives

public boolean attachPossessives()
Returns:
true if this object will attach NPs beginning with the tag POS with the previous NP.

attachOfs

public void attachOfs(boolean attachOfs)
Parameters:
attachOfs -

attachPossessives

public void attachPossessives(boolean attachPossessives)
Parameters:
attachPossessives -

lastChunkedSentenceStats

public OpenNlpSentenceChunkerStats lastChunkedSentenceStats()
Returns statistics about the last call to chunkSentence or null.


chunkSentence

public ChunkedSentence chunkSentence(java.lang.String sent)
Specified by:
chunkSentence in interface SentenceChunker