marf.nlp.Parsing.GrammarCompiler
Class ProbabilisticGrammarCompiler

java.lang.Object
  extended by marf.Storage.StorageManager
      extended by marf.nlp.Parsing.GrammarCompiler.GrammarCompiler
          extended by marf.nlp.Parsing.GrammarCompiler.ProbabilisticGrammarCompiler
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, IStorageManager

public class ProbabilisticGrammarCompiler
extends GrammarCompiler

Probabilistic Grammar Compiler processes a grammar enhanced with probability tokens assigned to each production.

$Id: ProbabilisticGrammarCompiler.java,v 1.21 2006/01/30 04:21:57 mokhov Exp $

Since:
0.3.0.2
Version:
$Revision: 1.21 $
Author:
Serguei Mokhov
See Also:
Serialized Form

Field Summary
 
Fields inherited from class marf.nlp.Parsing.GrammarCompiler.GrammarCompiler
oGrammar, oGrammarAnalyzer, oGrammarElement, oRule, oToken, soTransitionTable, strGrammarFileName, TOKEN_ACTION_BREAK, TOKEN_ACTION_CONTINUE, TOKEN_ACTION_PROCEED
 
Fields inherited from class marf.Storage.StorageManager
bDumpOnNotFound, iCurrentDumpMode, oObjectToSerialize, strFilename
 
Fields inherited from interface marf.Storage.IStorageManager
DUMP_BINARY, DUMP_CSV_TEXT, DUMP_GZIP_BINARY, DUMP_HTML, DUMP_SQL, DUMP_XML, MARF_INTERFACE_CODE_REVISION, STORAGE_FILE_EXTENSIONS
 
Constructor Summary
ProbabilisticGrammarCompiler(java.lang.String pstrGrammarFilename)
          Constructor with the grammar file filename.
 
Method Summary
protected  void addNextRHSElement()
          Overridden to possibly take into consideration the probability tokens.
 void compileGrammar()
          Compiles probabilistic grammar.
protected  void createEpsilonToken()
          Overridden not to create epsilon tokens for probabilistic grammars.
protected  void createGrammarAnalyzer()
          Instantiates ProbabilisticGrammarAnalyzer with the current grammar.
protected  void createRule()
          Overridden to take into account the probability of grammar productions.
static java.lang.String getMARFSourceCodeRevision()
          Retrieves class' revision.
 
Methods inherited from class marf.nlp.Parsing.GrammarCompiler.GrammarCompiler
addIDToken, addTerminalToken, checkUndefinedNonTerminals, createEOFTerminal, createNextNonTerminal, getBusted, getGrammar, getGrammarElement, getGrammarFileName, getNextRHSToken, getTransitionTable, loadTT, outputStats, parseGrammar, serialize
 
Methods inherited from class marf.Storage.StorageManager
backSynchronizeObject, clone, dump, dumpBinary, dumpCSV, dumpGzipBinary, dumpHTML, dumpSQL, dumpXML, enableDumpOnNotFound, equals, getDefaultExtension, getDefaultExtension, getDumpMode, getFilename, getObjectToSerialize, hashCode, restore, restoreBinary, restoreCSV, restoreGzipBinary, restoreHTML, restoreSQL, restoreXML, setDumpMode, setFilename, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProbabilisticGrammarCompiler

public ProbabilisticGrammarCompiler(java.lang.String pstrGrammarFilename)
                             throws CompilerError
Constructor with the grammar file filename.

Parameters:
pstrGrammarFilename - the filename of the grammar file to use
Throws:
CompilerError - if initialization fails
Method Detail

createGrammarAnalyzer

protected void createGrammarAnalyzer()
Instantiates ProbabilisticGrammarAnalyzer with the current grammar.

Overrides:
createGrammarAnalyzer in class GrammarCompiler
See Also:
GrammarCompiler.createGrammarAnalyzer(), ProbabilisticGrammarAnalyzer

compileGrammar

public void compileGrammar()
                    throws CompilerError
Compiles probabilistic grammar.

Overrides:
compileGrammar in class GrammarCompiler
Throws:
CompilerError - in case of parsing or lexical mistakes
See Also:
GrammarCompiler.compileGrammar()

createEpsilonToken

protected void createEpsilonToken()
Overridden not to create epsilon tokens for probabilistic grammars. Doesn't do anything.

Overrides:
createEpsilonToken in class GrammarCompiler
See Also:
GrammarCompiler.createEpsilonToken()

createRule

protected void createRule()
                   throws CompilerError
Overridden to take into account the probability of grammar productions.

Overrides:
createRule in class GrammarCompiler
Throws:
CompilerError - if a rule operator ::= or a probability are not found, or there was syntax error while scanning a token in
java.lang.NumberFormatException - if the probability cannot be parsed as valid double
See Also:
GrammarCompiler.createRule()

addNextRHSElement

protected void addNextRHSElement()
                          throws SyntaxError
Overridden to possibly take into consideration the probability tokens. Now off.

Overrides:
addNextRHSElement in class GrammarCompiler
Throws:
SyntaxError - if unrecognized token type found
See Also:
GrammarCompiler.addNextRHSElement()

getMARFSourceCodeRevision

public static java.lang.String getMARFSourceCodeRevision()
Retrieves class' revision.

Returns:
revision string


SourceForge Logo