opennlp.tools.postag
Class ExtendedPOSDictionary

java.lang.Object
  extended by opennlp.tools.postag.ExtendedPOSDictionary
All Implemented Interfaces:
Iterable<WordTag>, ExtendedTagDictionary, opennlp.tools.postag.TagDictionary, FeatureDictionary

public class ExtendedPOSDictionary
extends Object
implements Iterable<WordTag>, ExtendedTagDictionary

Provides a means of determining which tags are valid for a particular word based on a tag dictionary read from a file.


Constructor Summary
ExtendedPOSDictionary()
           
ExtendedPOSDictionary(boolean caseSensitive)
           
 
Method Summary
static ExtendedPOSDictionary create(InputStream in)
          Creates a new ExtendedPOSDictionary from a provided InputStream.
 String[] getCompleteTag(String word)
           
 String[] getFeatures(String word, String tag)
           
 String[] getFeatureTag(String word)
           
 String getLemma(String word, String tag)
           
 String[] getTags(String word)
          Returns a list of valid tags for the specified word.
 Iterator<WordTag> iterator()
          Retrieves an iterator over all words in the dictionary.
 void serialize(OutputStream out)
          Writes the ExtendedPOSDictionary to the given OutputStream; After the serialization is finished the provided OutputStream remains open.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExtendedPOSDictionary

public ExtendedPOSDictionary()

ExtendedPOSDictionary

public ExtendedPOSDictionary(boolean caseSensitive)
Method Detail

getTags

public String[] getTags(String word)
Returns a list of valid tags for the specified word.

Specified by:
getTags in interface opennlp.tools.postag.TagDictionary
Parameters:
word - The word.
Returns:
A list of valid tags for the specified word or null if no information is available for that word.

getFeatureTag

public String[] getFeatureTag(String word)
Specified by:
getFeatureTag in interface ExtendedTagDictionary

getCompleteTag

public String[] getCompleteTag(String word)
Specified by:
getCompleteTag in interface ExtendedTagDictionary

iterator

public Iterator<WordTag> iterator()
Retrieves an iterator over all words in the dictionary.

Specified by:
iterator in interface Iterable<WordTag>

serialize

public void serialize(OutputStream out)
               throws IOException
Writes the ExtendedPOSDictionary to the given OutputStream; After the serialization is finished the provided OutputStream remains open.

Parameters:
out - the OutputStream to write the dictionary into.
Throws:
IOException - if writing to the OutputStream fails

toString

public String toString()
Overrides:
toString in class Object

create

public static ExtendedPOSDictionary create(InputStream in)
                                    throws IOException,
                                           opennlp.tools.util.InvalidFormatException
Creates a new ExtendedPOSDictionary from a provided InputStream. After creation is finished the provided InputStream is closed.

Parameters:
in -
Returns:
the pos dictionary
Throws:
IOException
opennlp.tools.util.InvalidFormatException

getFeatures

public String[] getFeatures(String word,
                            String tag)
Specified by:
getFeatures in interface FeatureDictionary

getLemma

public String getLemma(String word,
                       String tag)
Specified by:
getLemma in interface ExtendedTagDictionary


Copyright © 2012-2013 CoGrOO. All Rights Reserved.