edu.stanford.nlp.tagger.maxent
Class GlobalHolder

java.lang.Object
  extended by edu.stanford.nlp.tagger.maxent.GlobalHolder

public class GlobalHolder
extends Object

This class holds many global variables and other things that are used by the Stanford MaxEnt Part-of-speech Tagger package.

Author:
Kristina Toutanova, Anna Rafferty

Method Summary
static boolean add(FeatureKey s)
          Adds a FeatureKey to the set of known FeatureKeys.
static boolean convertMultifileTagger(String filename, String newFilename, TaggerConfig config)
          This method is provided for backwards compatibility with the old tagger.
static LambdaSolve getLambdaSolve()
           
static int getNum(FeatureKey s)
           
static int getNum(FeatureKey s, HashMap<FeatureKey,Integer> fAssocs)
           
static void init()
           
static void init(TaggerConfig config)
           
static boolean isRare(String word)
           
static void putAssoc(FeatureKey s, int num)
           
static boolean read(String filename)
           
static HashMap<FeatureKey,Integer> readAssociations(String modelFilename)
          This reads the .assoc file.
static TaggerConfig readConfig(InputStream file)
          read in the TaggerConfig
static void readExtractors(InputStream file)
          read the extractors from a filename
static void readExtractors(String filename)
          read the extractors from a filename
static void release_mem()
           
static void save_after(OutDataStreamFile file)
           
static void save_prev(String filename)
           
static void save_prev(TaggerConfig config, OutDataStreamFile file)
           
static void saveConfig(TaggerConfig config, OutputStream os)
          serialize the TaggerConfig
static void saveExtractors(OutputStream os)
          serialize the ExtractorFrames and ExtractorFramesRare in filename
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getLambdaSolve

public static LambdaSolve getLambdaSolve()

init

public static void init()

init

public static void init(TaggerConfig config)

add

public static boolean add(FeatureKey s)
Adds a FeatureKey to the set of known FeatureKeys.

Parameters:
s - The feature key to be added
Returns:
Whether the key was already known (false) or added (true)

putAssoc

public static void putAssoc(FeatureKey s,
                            int num)

getNum

public static int getNum(FeatureKey s)

getNum

public static int getNum(FeatureKey s,
                         HashMap<FeatureKey,Integer> fAssocs)

saveConfig

public static void saveConfig(TaggerConfig config,
                              OutputStream os)
                       throws Exception
serialize the TaggerConfig

Throws:
Exception

readConfig

public static TaggerConfig readConfig(InputStream file)
                               throws Exception
read in the TaggerConfig

Throws:
Exception

saveExtractors

public static void saveExtractors(OutputStream os)
                           throws Exception
serialize the ExtractorFrames and ExtractorFramesRare in filename

Throws:
Exception

readExtractors

public static void readExtractors(String filename)
                           throws Exception
read the extractors from a filename

Throws:
Exception

readExtractors

public static void readExtractors(InputStream file)
                           throws Exception
read the extractors from a filename

Throws:
Exception

save_prev

public static void save_prev(String filename)

save_prev

public static void save_prev(TaggerConfig config,
                             OutDataStreamFile file)

readAssociations

public static HashMap<FeatureKey,Integer> readAssociations(String modelFilename)
This reads the .assoc file. It is only used by LambdaSolveTagger.java The same associations also appear in the main file, and are read by read(), read_prev().

Parameters:
modelFilename - The string .assoc is appended and feature associations are then read from this file
Returns:
The feature associations HashMap, or null if there is an error

release_mem

public static void release_mem()

save_after

public static void save_after(OutDataStreamFile file)

convertMultifileTagger

public static boolean convertMultifileTagger(String filename,
                                             String newFilename,
                                             TaggerConfig config)
                                      throws Exception
This method is provided for backwards compatibility with the old tagger. It reads a tagger that was saved as multiple files into the current format and saves it back out as a single file, newFilename.

Parameters:
filename -
newFilename -
Returns:
Throws:
Exception

read

public static boolean read(String filename)
                    throws Exception
Throws:
Exception

isRare

public static boolean isRare(String word)


Stanford NLP Group