textmaven.application.translator
Class Processor

java.lang.Object
  extended bytextmaven.application.translator.Processor
All Implemented Interfaces:
Globals, IProcessor

public class Processor
extends java.lang.Object
implements IProcessor, Globals

Version:
1.0
Author:
Thomas Krebs

Field Summary
 
Fields inherited from interface textmaven.Globals
C_ATTR_CLASSNAME, C_DICT_BASE_TYPE, C_DICT_TYPE, C_SERVER_BASE_TYPE, C_STEMMER_BASE_TYPE, C_WRITER_BASE_TYPE, CONFIG_FILE, DEFAULT_SENTENCES, DEFAULT_SEPARATOR, NEW_PARA, T_COL_DICTIONARY, T_COL_HOMONYMID, T_COL_ID, T_COL_LEXKEY, T_COL_TRANSLATION, T_COL_WORDCLASS, VERBOSE
 
Constructor Summary
Processor()
           
 
Method Summary
 void configure(java.lang.String[] args)
          Configures instance from command line parameters
 java.lang.String getBook()
          Get book title.
 IDictionary getDictionary()
           
 java.lang.String getErrorFile()
          Returns error file.
 java.lang.String getInputFile()
          Gets input file.
 int getNrOfSentences()
          Gets number of sentences
 java.lang.String getOutputFile()
          Returns output file.
 java.lang.String getSeparator()
           
 ITranslationWriter getWriter()
          Returns configured writer
 boolean isGreedy()
           
 void setBook(java.lang.String book)
          Sets book title.
 void setDictionary(IDictionary dictionary)
           
 void setErrorFile(java.lang.String fName)
          Sets error file.
 void setGreedy(boolean greedy)
           
 void setInputFile(java.lang.String fName)
          Sets the inputFile.
 void setNrOfSentences(int n)
          Sets number of sentences
 void setOutputFile(java.lang.String fName)
          Sets output file.
 void setWriter(ITranslationWriter writer)
          Sets id of writer to be used
 void start(java.lang.String[] params)
          Starts processing based on the configuration file and state of the instance.
 void usage()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Processor

public Processor()
Method Detail

start

public void start(java.lang.String[] params)
           throws java.lang.Throwable
Starts processing based on the configuration file and state of the instance.
Before calling this method either the parseCommandLine() method or the appropriate setters have to be called to setup the instance appropriately. At least the input and output file have to be set.
The input file is expected to be in the following format:
key;pageNr;chapter;dictionary
The only mandatory field is key, the rest is optional, and can be left empty. pageNr and chapter are printed in the output as specified. The field dictionary allows to override the configured dictionary for this specific key. It takes exactly the same syntax as the -d option on the commandline.

Specified by:
start in interface IProcessor
Throws:
java.lang.Throwable - error processing file

getSeparator

public java.lang.String getSeparator()
Returns:
Returns the separator.

configure

public final void configure(java.lang.String[] args)
Configures instance from command line parameters

Parameters:
args - command line

usage

public final void usage()
Specified by:
usage in interface IProcessor

setBook

public final void setBook(java.lang.String book)
Sets book title.

Parameters:
book -

getBook

public final java.lang.String getBook()
Get book title.

Returns:
String - book title

setNrOfSentences

public final void setNrOfSentences(int n)
Sets number of sentences

Parameters:
n - number of sentences

getNrOfSentences

public final int getNrOfSentences()
Gets number of sentences

Returns:
number of sentences to be determined

setInputFile

public final void setInputFile(java.lang.String fName)
Sets the inputFile.

Parameters:
fName -

getInputFile

public final java.lang.String getInputFile()
Gets input file.

Returns:
String

setOutputFile

public final void setOutputFile(java.lang.String fName)
Sets output file.

Parameters:
fName -

getOutputFile

public final java.lang.String getOutputFile()
Returns output file.

Returns:
String

setErrorFile

public final void setErrorFile(java.lang.String fName)
Sets error file.

Parameters:
fName -

getErrorFile

public final java.lang.String getErrorFile()
Returns error file.

Returns:
String

setWriter

public final void setWriter(ITranslationWriter writer)
Sets id of writer to be used

Parameters:
writer - to be used for writing translations

getWriter

public final ITranslationWriter getWriter()
Returns configured writer

Returns:
String

isGreedy

public boolean isGreedy()
Returns:
Returns the greedy.

setGreedy

public void setGreedy(boolean greedy)
Parameters:
greedy - The greedy to set.

getDictionary

public IDictionary getDictionary()
Returns:
Returns the dictionary.

setDictionary

public void setDictionary(IDictionary dictionary)
Parameters:
dictionary - The dictionary to set.


Copyright © 2002-2005 Sourceforge. All Rights Reserved.