org.annolab.tt4j
Class TreeTaggerModelReader

java.lang.Object
  extended by org.annolab.tt4j.TreeTaggerModelReader

public class TreeTaggerModelReader
extends Object

Reader for TreeTagger model files.

Author:
Richard Eckart de Castilho

Constructor Summary
TreeTaggerModelReader()
           
 
Method Summary
protected  boolean decodeVersion(TreeTaggerModel aModel, int aVersion, ByteOrder aByteOrder)
           
 String getEncoding()
          Get the encoding used for reading the dictionary.
 boolean isReadDictionary()
          Check if the dictionary is read or skipped.
 TreeTaggerModel read(InputStream aIn)
          Read the model from a stream.
protected  List<String> readStrings(int aCount)
           
protected  byte[] readZeroTerminatedByteArray()
           
protected  String readZeroTerminatedString(String aCharsetName)
           
 void setEncoding(String aCharsetName)
          Set the encoding used by the dictionary.
 void setReadDictionary(boolean aReadDictionary)
          Set if the dictionary is read or skipped.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeTaggerModelReader

public TreeTaggerModelReader()
Method Detail

read

public TreeTaggerModel read(InputStream aIn)
                     throws IOException
Read the model from a stream.

Parameters:
aIn - an input stream.
Returns:
the decoded model.
Throws:
IOException

readStrings

protected List<String> readStrings(int aCount)
                            throws IOException
Throws:
IOException

decodeVersion

protected boolean decodeVersion(TreeTaggerModel aModel,
                                int aVersion,
                                ByteOrder aByteOrder)

readZeroTerminatedString

protected String readZeroTerminatedString(String aCharsetName)
                                   throws IOException
Throws:
IOException

readZeroTerminatedByteArray

protected byte[] readZeroTerminatedByteArray()
                                      throws IOException
Throws:
IOException

getEncoding

public String getEncoding()
Get the encoding used for reading the dictionary. This information need to be provided externally, it is not present in the TreeTagger model file. Per default, the UTF-8 character set is used.


setEncoding

public void setEncoding(String aCharsetName)
Set the encoding used by the dictionary.


isReadDictionary

public boolean isReadDictionary()
Check if the dictionary is read or skipped. Per default the dictionary is read.


setReadDictionary

public void setReadDictionary(boolean aReadDictionary)
Set if the dictionary is read or skipped.



Copyright © 2012. All Rights Reserved.