MaltParser 1.0.1

org.maltparser.core.config
Class SingleMaltConfiguration

java.lang.Object
  extended by org.maltparser.core.config.SingleMaltConfiguration
All Implemented Interfaces:
Configuration, Guidable

public class SingleMaltConfiguration
extends Object
implements Configuration, Guidable

SingleMaltConfiguration handles deterministic parsing algorithms such as Nivre Arc-eager, Nivre Arc-standard, Covington Non-projective and Covington projective. It is possible to run the Single Malt configuration in six different modes:

This class also implements the interface Guidable, which means that it should provide guidance to the parsing algorithm when requested and collect training instances during oracle parsing. In the current implementation of single malt configuration it redirects these duties to a guide model.

Since:
1.0
Author:
Johan Hall
See Also:
Configuration

Field Summary
protected  ConfigurationDir configDir
           
protected  org.apache.log4j.Logger configLogger
           
protected  Integer containerIndex
           
protected  SimpleDateFormat dateFormat
           
static int DEPROJ
           
protected  long endTime
           
protected  Guide guide
           
static int INFO
           
protected  DataFormatSpecification inputFormat
           
static int LEARN
           
protected  int mode
           
protected  DataFormatSpecification outputFormat
           
static int PARSE
           
protected  ParsingAlgorithm parsingAlgorithm
           
static int PROJ
           
protected  DataReader reader
           
protected  Sentence sentence
           
protected  long startTime
           
protected  SymbolTableHandler symbolTables
           
static int UNPACK
           
protected  DataWriter writer
           
 
Constructor Summary
SingleMaltConfiguration()
           
 
Method Summary
 void checkOptionDependency()
           
protected  void deprojectivize()
           
 void finalize()
           
 org.apache.log4j.Logger getConfigLogger()
           
 File getFile(String suffix)
           
 BufferedWriter getInfoFileWriter()
           
 InputStreamReader getInputStreamReader(String suffix)
           
 int getMode()
           
 String getName()
           
 Object getOptionValue(String optiongroup, String optionname)
           
protected  String getOptionValueString(String optiongroup, String optionname)
           
 OutputStreamWriter getOutputStreamWriter(String suffix)
           
 ParsingAlgorithm getParsingAlgorithm()
          Returns the parsing algorithm in use
 Sentence getSentence()
          Returns the sentence
 SymbolTableHandler getSymbolTables()
          Returns the list of symbol tables
protected  void initConfigLogger()
           
protected  void initConfigurationDir()
          Creates a configuration directory and assign the configuration a name.
 void initialize(Integer containerIndex)
          Configuration interface
protected  void initInput()
          Initialize the input.
protected  void initMode()
          Initialize the configuration mode
protected  void initOutput()
          Initialize the output with a data writer
protected  void initParsingAlgorithm()
          Initialize the parsing algorithm
protected  void learn()
          Learns how to parse sentences in a language.
protected  void parse()
          Parses sentences from the data source.
 boolean predict()
          This method is used during parsing.
 boolean predictFromKBestList()
          This method is used during parsing.
 void process()
           
protected  void projectivize()
           
 void setInstance(ParserAction parserAction)
          This method is used during learning.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LEARN

public static final int LEARN
See Also:
Constant Field Values

PARSE

public static final int PARSE
See Also:
Constant Field Values

UNPACK

public static final int UNPACK
See Also:
Constant Field Values

INFO

public static final int INFO
See Also:
Constant Field Values

PROJ

public static final int PROJ
See Also:
Constant Field Values

DEPROJ

public static final int DEPROJ
See Also:
Constant Field Values

configLogger

protected org.apache.log4j.Logger configLogger

configDir

protected ConfigurationDir configDir

containerIndex

protected Integer containerIndex

parsingAlgorithm

protected ParsingAlgorithm parsingAlgorithm

guide

protected Guide guide

sentence

protected Sentence sentence

inputFormat

protected DataFormatSpecification inputFormat

outputFormat

protected DataFormatSpecification outputFormat

reader

protected DataReader reader

writer

protected DataWriter writer

mode

protected int mode

symbolTables

protected SymbolTableHandler symbolTables

startTime

protected long startTime

endTime

protected long endTime

dateFormat

protected SimpleDateFormat dateFormat
Constructor Detail

SingleMaltConfiguration

public SingleMaltConfiguration()
                        throws MaltChainedException
Throws:
MaltChainedException
Method Detail

initialize

public void initialize(Integer containerIndex)
                throws MaltChainedException
Configuration interface

Specified by:
initialize in interface Configuration
Throws:
MaltChainedException

process

public void process()
             throws MaltChainedException
Specified by:
process in interface Configuration
Throws:
MaltChainedException

finalize

public void finalize()
              throws MaltChainedException
Specified by:
finalize in interface Configuration
Overrides:
finalize in class Object
Throws:
MaltChainedException

getMode

public int getMode()
Specified by:
getMode in interface Configuration

getOutputStreamWriter

public OutputStreamWriter getOutputStreamWriter(String suffix)
                                         throws MaltChainedException
Specified by:
getOutputStreamWriter in interface Configuration
Throws:
MaltChainedException

getInputStreamReader

public InputStreamReader getInputStreamReader(String suffix)
                                       throws MaltChainedException
Specified by:
getInputStreamReader in interface Configuration
Throws:
MaltChainedException

getFile

public File getFile(String suffix)
             throws MaltChainedException
Specified by:
getFile in interface Configuration
Throws:
MaltChainedException

getInfoFileWriter

public BufferedWriter getInfoFileWriter()
                                 throws MaltChainedException
Specified by:
getInfoFileWriter in interface Configuration
Throws:
MaltChainedException

getConfigLogger

public org.apache.log4j.Logger getConfigLogger()
Specified by:
getConfigLogger in interface Configuration

getName

public String getName()
Specified by:
getName in interface Configuration

getOptionValue

public Object getOptionValue(String optiongroup,
                             String optionname)
                      throws MaltChainedException
Specified by:
getOptionValue in interface Configuration
Throws:
MaltChainedException

getOptionValueString

protected String getOptionValueString(String optiongroup,
                                      String optionname)
                               throws MaltChainedException
Throws:
MaltChainedException

setInstance

public void setInstance(ParserAction parserAction)
                 throws MaltChainedException
This method is used during learning. Currently, the MaltParserConfiguration redirect the instance to the guide. Maybe in the future this method will be re-implemented to add some interesting things or maybe not.

Specified by:
setInstance in interface Guidable
Parameters:
parserAction -
Throws:
MaltChainedException

predictFromKBestList

public boolean predictFromKBestList()
                             throws MaltChainedException
This method is used during parsing. Currently, the MaltParserConfiguration redirect the request to the guide. Maybe in the future this method will be re-implemented to add some interesting things or maybe not.

Specified by:
predictFromKBestList in interface Guidable
Throws:
MaltChainedException

predict

public boolean predict()
                throws MaltChainedException
This method is used during parsing. Currently, the MaltParserConfiguration redirect the request to the guide. Maybe in the future this method will be re-implemented to add some interesting things or maybe not.

Specified by:
predict in interface Guidable
Throws:
MaltChainedException

getSymbolTables

public SymbolTableHandler getSymbolTables()
Returns the list of symbol tables

Returns:
the list of symbol tables

getSentence

public Sentence getSentence()
Returns the sentence

Returns:
the sentence

getParsingAlgorithm

public ParsingAlgorithm getParsingAlgorithm()
Returns the parsing algorithm in use

Returns:
the parsing algorithm in use

learn

protected void learn()
              throws MaltChainedException
Learns how to parse sentences in a language. The data reader reads a sentence into the sentence data structure. A dependency graph is build according to the gold standard. The gold standard graph is send to the oracle parser for a specific parsing algorithm.

Throws:
MaltChainedException

parse

protected void parse()
              throws MaltChainedException
Parses sentences from the data source. The data reader reads a sentence into the sentence data structure and the parsing algorithm parses the sentence. Finally, the data writer writes to the data destination (often a file).

Throws:
MaltChainedException

projectivize

protected void projectivize()
                     throws MaltChainedException
Throws:
MaltChainedException

deprojectivize

protected void deprojectivize()
                       throws MaltChainedException
Throws:
MaltChainedException

initMode

protected void initMode()
                 throws MaltChainedException
Initialize the configuration mode

Throws:
MaltChainedException

initConfigurationDir

protected void initConfigurationDir()
                             throws MaltChainedException
Creates a configuration directory and assign the configuration a name.

Throws:
MaltChainedException

initConfigLogger

protected void initConfigLogger()
                         throws MaltChainedException
Throws:
MaltChainedException

initInput

protected void initInput()
                  throws MaltChainedException
Initialize the input. Creates a symbol table handler and a sentence. The data writer reads into the sentence.

Throws:
MaltChainedException

initOutput

protected void initOutput()
                   throws MaltChainedException
Initialize the output with a data writer

Throws:
MaltChainedException

initParsingAlgorithm

protected void initParsingAlgorithm()
                             throws MaltChainedException
Initialize the parsing algorithm

Throws:
MaltChainedException

checkOptionDependency

public void checkOptionDependency()
                           throws MaltChainedException
Throws:
MaltChainedException

toString

public String toString()
Overrides:
toString in class Object

MaltParser 1.0.1

Copyright 2007 Johan Hall, Jens Nilsson and Joakim Nivre.