info.ephyra.nlp
Class StanfordPosTagger

java.lang.Object
  extended by info.ephyra.nlp.StanfordPosTagger

public class StanfordPosTagger
extends java.lang.Object

This class provides an interface to the Stanford part of speech tagger.

Version:
2008-02-01
Author:
Manas Pathak

Constructor Summary
StanfordPosTagger()
           
 
Method Summary
private static edu.stanford.nlp.ling.Sentence createSentence(java.lang.String[] tokens)
          Combines the tokens into a Sentence
static boolean init(java.lang.String model)
          Initializes the POS Tagger
static void main(java.lang.String[] args)
           
static java.lang.String tagPos(java.lang.String text)
          Tags a String with part of speech
static java.lang.String[] tagPos(java.lang.String[] tokens)
          Tags the tokens with part of speech
static java.lang.String[] tokenize(java.lang.String sentence)
          Splits the sentence into individual tokens.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StanfordPosTagger

public StanfordPosTagger()
Method Detail

init

public static boolean init(java.lang.String model)
Initializes the POS Tagger

Parameters:
model - model file
Returns:
true, iff the POS tagger was initialized successfully

tokenize

public static java.lang.String[] tokenize(java.lang.String sentence)
Splits the sentence into individual tokens.

Parameters:
sentence - Input sentence
Returns:
Array of tokens

tagPos

public static java.lang.String[] tagPos(java.lang.String[] tokens)
Tags the tokens with part of speech

Parameters:
tokens - Array of token strings
Returns:
Part of speech tags

createSentence

private static edu.stanford.nlp.ling.Sentence createSentence(java.lang.String[] tokens)
Combines the tokens into a Sentence

Parameters:
tokens -
Returns:
Sentence made of the tokens

tagPos

public static java.lang.String tagPos(java.lang.String text)
Tags a String with part of speech

Parameters:
text - Input String
Returns:
String tagged with part of speech in "word/tag" notation

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception