edu.washington.cs.knowitall.nlp
Class OpenNlpChunkedSentenceParser

java.lang.Object
  extended by edu.washington.cs.knowitall.nlp.OpenNlpChunkedSentenceParser

public class OpenNlpChunkedSentenceParser
extends Object

A utility class for "parsing" the output of the OpenNLP command line chunker. The command line chunker returns strings in this form:

[NP JFK/NNP] [VP was/VBD elected/VBN] [NP president/NN] [PP in/IN] [NP 1960/CD] ./.

This class converts that String representation into a ChunkedSentence object.

Author:
afader

Constructor Summary
OpenNlpChunkedSentenceParser()
           
 
Method Summary
 boolean attachOfs()
           
 void attachOfs(boolean attachOfs)
           
 boolean attachPossessives()
           
 void attachPossessives(boolean attachPossessives)
           
 ChunkedSentence parseSentence(String sent)
          Converts sent into a ChunkedSentence object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OpenNlpChunkedSentenceParser

public OpenNlpChunkedSentenceParser()
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 -

parseSentence

public ChunkedSentence parseSentence(String sent)
                              throws ParseException
Converts sent into a ChunkedSentence object.

Parameters:
sent -
Returns:
the chunked representation
Throws:
ParseException - if sent is malformed.


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