sg.edu.nus.comp.nlp.ims.util
Class COpenNLPPOSTagger

java.lang.Object
  extended by sg.edu.nus.comp.nlp.ims.util.APTBPOSTagger
      extended by sg.edu.nus.comp.nlp.ims.util.COpenNLPPOSTagger
All Implemented Interfaces:
IPOSTagger

public final class COpenNLPPOSTagger
extends APTBPOSTagger

opennlp POS tagger.

Author:
zhongzhi

Field Summary
 
Fields inherited from class sg.edu.nus.comp.nlp.ims.util.APTBPOSTagger
POSSET, POSSTANDARD
 
Constructor Summary
COpenNLPPOSTagger()
          constructor
COpenNLPPOSTagger(opennlp.tools.ngram.Dictionary p_Dict)
          constructor
COpenNLPPOSTagger(opennlp.tools.ngram.Dictionary p_Dictionary, opennlp.tools.postag.POSDictionary p_POSDict)
          constructor
COpenNLPPOSTagger(java.io.File p_ModelFile)
          constructor
COpenNLPPOSTagger(opennlp.maxent.MaxentModel p_Model)
          constructor
COpenNLPPOSTagger(opennlp.maxent.MaxentModel p_Model, opennlp.tools.ngram.Dictionary p_Dictionary)
          constructor
COpenNLPPOSTagger(opennlp.maxent.MaxentModel p_Model, opennlp.tools.ngram.Dictionary p_Dictionary, opennlp.tools.postag.POSDictionary p_POSDict)
          constructor
COpenNLPPOSTagger(opennlp.maxent.MaxentModel p_Model, opennlp.tools.postag.POSDictionary p_POSDict)
          constructor
COpenNLPPOSTagger(opennlp.tools.postag.POSDictionary p_POSDict)
          constructor
COpenNLPPOSTagger(java.lang.String p_ModelFile)
          constructor
 
Method Summary
 java.lang.String getTag(java.lang.String input)
          get the tag of a tagged token
 java.lang.String getToken(java.lang.String input)
          get the original token of a tagged token
static void main(java.lang.String[] args)
          pos tag a given file, which was supposed to be tokenized
static void setDefaultDictionary(opennlp.tools.ngram.Dictionary p_Dict)
          set default tag dictionary
static void setDefaultDictionary(java.lang.String p_FileName)
          set default tag dictionary
static void setDefaultModel(java.io.File p_File)
          set default POS tagger model
static void setDefaultModel(opennlp.maxent.GISModel p_Model)
          set default pos tagger model
static void setDefaultModel(java.lang.String p_FileName)
          set default pos tagger model
static void setDefaultPOSDictionary(java.io.BufferedReader p_Reader)
          set default tag dictionary
static void setDefaultPOSDictionary(java.io.BufferedReader p_Reader, boolean caseSensitive)
          set default tag dictionary
static void setDefaultPOSDictionary(opennlp.tools.postag.POSDictionary p_POSDict)
          set default tag dictionary
static void setDefaultPOSDictionary(java.lang.String p_File)
          set default tag dictionary
static void setDefaultPOSDictionary(java.lang.String p_FileName, boolean caseSensitive)
          set default tag dictionary
 java.lang.String tag(java.lang.String p_Sentence)
          tag a tokenized input sentence
 
Methods inherited from class sg.edu.nus.comp.nlp.ims.util.APTBPOSTagger
getShortForm
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

COpenNLPPOSTagger

public COpenNLPPOSTagger()
constructor


COpenNLPPOSTagger

public COpenNLPPOSTagger(opennlp.maxent.MaxentModel p_Model)
constructor

Parameters:
p_Model - opennlp pos tagger model

COpenNLPPOSTagger

public COpenNLPPOSTagger(java.io.File p_ModelFile)
                  throws java.io.IOException
constructor

Parameters:
p_ModelFile - model file
Throws:
java.io.IOException - exception while reading model

COpenNLPPOSTagger

public COpenNLPPOSTagger(java.lang.String p_ModelFile)
                  throws java.io.IOException
constructor

Parameters:
p_ModelFile - model file
Throws:
java.io.IOException - exception while reading model

COpenNLPPOSTagger

public COpenNLPPOSTagger(opennlp.tools.ngram.Dictionary p_Dict)
constructor

Parameters:
p_Dict - dictionary

COpenNLPPOSTagger

public COpenNLPPOSTagger(opennlp.tools.postag.POSDictionary p_POSDict)
constructor

Parameters:
p_POSDict - pos dictionary

COpenNLPPOSTagger

public COpenNLPPOSTagger(opennlp.maxent.MaxentModel p_Model,
                         opennlp.tools.postag.POSDictionary p_POSDict)
constructor

Parameters:
p_Model - pos tagger model
p_POSDict - pos dictionary

COpenNLPPOSTagger

public COpenNLPPOSTagger(opennlp.maxent.MaxentModel p_Model,
                         opennlp.tools.ngram.Dictionary p_Dictionary)
constructor

Parameters:
p_Model - pos tagger model
p_Dictionary - dictionary

COpenNLPPOSTagger

public COpenNLPPOSTagger(opennlp.tools.ngram.Dictionary p_Dictionary,
                         opennlp.tools.postag.POSDictionary p_POSDict)
constructor

Parameters:
p_Dictionary - dictionary
p_POSDict - pos dictionary

COpenNLPPOSTagger

public COpenNLPPOSTagger(opennlp.maxent.MaxentModel p_Model,
                         opennlp.tools.ngram.Dictionary p_Dictionary,
                         opennlp.tools.postag.POSDictionary p_POSDict)
constructor

Parameters:
p_Model - pos tagger model
p_Dictionary - dictionary
p_POSDict - pos dictionary
Method Detail

setDefaultModel

public static void setDefaultModel(opennlp.maxent.GISModel p_Model)
set default pos tagger model

Parameters:
p_Model - model

setDefaultModel

public static void setDefaultModel(java.io.File p_File)
                            throws java.io.IOException
set default POS tagger model

Parameters:
p_File - model file
Throws:
java.io.IOException - exception while reading model

setDefaultModel

public static void setDefaultModel(java.lang.String p_FileName)
                            throws java.io.IOException
set default pos tagger model

Parameters:
p_FileName - model file name
Throws:
java.io.IOException - exception while read model

setDefaultDictionary

public static void setDefaultDictionary(opennlp.tools.ngram.Dictionary p_Dict)
set default tag dictionary

Parameters:
p_Dict - dictionary

setDefaultDictionary

public static void setDefaultDictionary(java.lang.String p_FileName)
                                 throws java.io.IOException
set default tag dictionary

Parameters:
p_FileName - dictionary name
Throws:
java.io.IOException - exception while reading dictionary

setDefaultPOSDictionary

public static void setDefaultPOSDictionary(opennlp.tools.postag.POSDictionary p_POSDict)
set default tag dictionary

Parameters:
p_POSDict - dictionary

setDefaultPOSDictionary

public static void setDefaultPOSDictionary(java.lang.String p_File)
                                    throws java.io.IOException
set default tag dictionary

Parameters:
p_File - dictionary file
Throws:
java.io.IOException - exception while reading dictionary

setDefaultPOSDictionary

public static void setDefaultPOSDictionary(java.lang.String p_FileName,
                                           boolean caseSensitive)
                                    throws java.io.IOException
set default tag dictionary

Parameters:
p_FileName - dictionary file name
caseSensitive - case sensitive
Throws:
java.io.IOException - exception while read dictionary

setDefaultPOSDictionary

public static void setDefaultPOSDictionary(java.io.BufferedReader p_Reader)
                                    throws java.io.IOException
set default tag dictionary

Parameters:
p_Reader - dictionary reader
Throws:
java.io.IOException - exception while reading dictionary

setDefaultPOSDictionary

public static void setDefaultPOSDictionary(java.io.BufferedReader p_Reader,
                                           boolean caseSensitive)
                                    throws java.io.IOException
set default tag dictionary

Parameters:
p_Reader - dictionary reader
caseSensitive - case sensitive
Throws:
java.io.IOException - exception while read dictionary

tag

public java.lang.String tag(java.lang.String p_Sentence)
Description copied from interface: IPOSTagger
tag a tokenized input sentence

Parameters:
p_Sentence - a tokenized sentence
Returns:
sentence with tag for each token

getTag

public java.lang.String getTag(java.lang.String input)
Description copied from interface: IPOSTagger
get the tag of a tagged token

Parameters:
input - a tagged token
Returns:
tag

getToken

public java.lang.String getToken(java.lang.String input)
Description copied from interface: IPOSTagger
get the original token of a tagged token

Parameters:
input - a tagged token
Returns:
original token

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
pos tag a given file, which was supposed to be tokenized

Parameters:
args -
Throws:
java.io.IOException