edu.washington.cs.knowitall.nlp
Class OpenNlpSentenceChunker
java.lang.Object
edu.washington.cs.knowitall.nlp.OpenNlpSentenceChunker
- All Implemented Interfaces:
- SentenceChunker
public class OpenNlpSentenceChunker
- extends Object
- implements SentenceChunker
A class that combines OpenNLP tokenizer, POS tagger, and chunker objects into
a single object that converts String sentences to ChunkedSentence
objects. By default, uses the models from
DefaultObjects.getDefaultTokenizer(),
DefaultObjects.getDefaultPosTagger(), and
DefaultObjects.getDefaultChunker().
- Author:
- afader
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
OpenNlpSentenceChunker
public OpenNlpSentenceChunker()
throws IOException
- Constructs a new object using the default models from
DefaultObjects.
- Throws:
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 -
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 -
chunkSentence
public ChunkedSentence chunkSentence(String sent)
throws ChunkerException
- Specified by:
chunkSentence in interface SentenceChunker
- Throws:
ChunkerException
Copyright © 2010-2012 University of Washington CSE. All Rights Reserved.