hyspirit.engines
Class HyText2POOLEngine

java.lang.Object
  extended by hyspirit.engines.HyEngine
      extended by hyspirit.engines.HyAnalysisEngine
          extended by hyspirit.engines.HyText2POOLEngine
All Implemented Interfaces:
java.lang.Runnable

public class HyText2POOLEngine
extends HyAnalysisEngine


Field Summary
 
Fields inherited from class hyspirit.engines.HyAnalysisEngine
filenames
 
Fields inherited from class hyspirit.engines.HyEngine
argumentString, LOG, stdin, TIME_PREFIX
 
Constructor Summary
HyText2POOLEngine()
          This constructor tries to determine the HySpirit environment automatically
HyText2POOLEngine(HySpiritProperties hyspirit)
          This constructor must be used if you are going to start your own engine process (client/server mode).
 
Method Summary
 void addMorpheme(java.lang.String morpheme)
          Delare a word as a morpheme, i.e. exclude it from stemming.
 void addMorphemeFile(java.lang.String filename)
          Add a file containing morphemes.
 void addStemRulesFile(java.lang.String filename)
          Adds a file that contains stemming rules.
 void addStopword(java.lang.String stopword)
          Delare a word as a stopword.
 void addStopwordFile(java.lang.String filename)
          Add a file containing stopword.
 void addTextFile(java.lang.String filename)
           
protected  java.lang.String[] buildCommand()
          Builds the command from the parameters.
 void cwa(boolean cwa)
          Sets open world assumption (cwa = false) or closed world assumption (cwa = true).
 java.lang.String echoSpecial(java.lang.String message)
          Returns a string which lets the engine echo the given message
protected  java.lang.String getStreamEndMessage()
          Returns the stream end message.
 void maxStringLength(int maxStringLength)
          Sets the maximum string length.
 void maxWordLength(int maxWordLength)
          Sets the maximum word length.
 void minStringLength(int minStringLength)
          Sets the minimum string length.
 void minWordLength(int minWordLength)
          Sets the minimum word length.
 void negationRegex(java.lang.String negationRegex)
          The regular expression for negation recognition.
 void numberOfTrigrams(int numberOfTrigrams)
          The number of troigrams to be generated.
 void numberRegex(java.lang.String numberRegex)
          The regular expression for number recognition.
 void parseNegation(boolean negation)
          Whether to interpret the word "not" or not.
 void recogniseClassifications(boolean classifications)
          Whether to recognise classifications or not.
 void recogniseNumbers(boolean numbers)
          Whether to recognise numbers or not.
 void recogniseRelationships(boolean relationships)
          Whether to recognise relationships or not.
 void recogniseStrings(boolean strings)
          Whether to recognise strings or not.
 void reset()
          Resets all parameters of the engine after destroying a possibly running process.
 void skip(java.lang.String skipRegex)
          Skip signs and words matching the given regular expression.
 void stemming(boolean stemming)
          Whether stemming should be applied or not.
 void stringRegex(java.lang.String stringRegex)
          The regular expression for string recognition.
 void translateUmlauts(boolean umlauts)
          Whether to translate umlauts to aeoeue.
 void wordRegex(java.lang.String wordRegex)
          The regular expression for word recognition.
 void wordSep(java.lang.String wordSep)
          Regular expression of word separators.
 
Methods inherited from class hyspirit.engines.HyAnalysisEngine
addFile, context, context, runAndWait
 
Methods inherited from class hyspirit.engines.HyEngine
closeSTDIN, destroy, exitValue, getCommand, getEngineName, getInputReader, getOutputWriter, getPercentageCPU, getRealTime, getSTDERR, getSTDIN, getSTDOUT, getSysTime, getUserTime, hasNext, isInClientMode, isRunning, kb, kb, kb, next, readFromSTDIN, restart, run, send, send, sendAndReceive, sendFile, setArgumentString, setLogger, start, suppressSTDERR, takesTime, takeTime, waitFor, waitTillRunning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HyText2POOLEngine

public HyText2POOLEngine()
                  throws HySpiritException
This constructor tries to determine the HySpirit environment automatically

Throws:
HySpiritException - if the HySiprit environment cannot be determined

HyText2POOLEngine

public HyText2POOLEngine(HySpiritProperties hyspirit)
                  throws HySpiritException
This constructor must be used if you are going to start your own engine process (client/server mode).

Parameters:
hyspirit - the HySpirit properties containing the environment
Throws:
HySpiritException - if we can't determine the environment
Method Detail

getStreamEndMessage

protected java.lang.String getStreamEndMessage()
Returns the stream end message. The stream end message is needed for send in order to determine when the whole output is read.

Overrides:
getStreamEndMessage in class HyEngine
Returns:
the stream end message (null if there is no stream end message)

echoSpecial

public java.lang.String echoSpecial(java.lang.String message)
Returns a string which lets the engine echo the given message

Overrides:
echoSpecial in class HyEngine
Parameters:
message - the message to be echoed
Returns:
the echo string (null if no echoing is allowed)

stemming

public void stemming(boolean stemming)
Whether stemming should be applied or not.

Parameters:
stemming - ue if stemming should be applied, false if not

addStemRulesFile

public void addStemRulesFile(java.lang.String filename)
Adds a file that contains stemming rules. See hy_text2pool manual for further details.

Parameters:
filename - the name of the file containing stemming rules

addMorpheme

public void addMorpheme(java.lang.String morpheme)
Delare a word as a morpheme, i.e. exclude it from stemming. For a huge amount of morphemes, store them in a file and use addMorphemeFile(). See hy_text2pool manual for further details.

Parameters:
morpheme - the word to be excluded from stemming

addMorphemeFile

public void addMorphemeFile(java.lang.String filename)
Add a file containing morphemes. See hy_text2pool manual for further details.

Parameters:
filename -

addStopword

public void addStopword(java.lang.String stopword)
Delare a word as a stopword. Usually, stopwords are stored in a file which is added with addStopwordFile(). See hy_text2pool manual for further details.

Parameters:
stopword - the word to be excluded from stemming

addStopwordFile

public void addStopwordFile(java.lang.String filename)
Add a file containing stopword. See hy_text2pool manual for further details.

Parameters:
filename -

translateUmlauts

public void translateUmlauts(boolean umlauts)
Whether to translate umlauts to aeoeue. See hy_text2pool manual for further details.

Parameters:
umlauts - - flag for using umlauts

numberOfTrigrams

public void numberOfTrigrams(int numberOfTrigrams)
The number of troigrams to be generated. See hy_text2pool manual for further details.

Parameters:
numberOfTrigrams -

parseNegation

public void parseNegation(boolean negation)
Whether to interpret the word "not" or not. Only useful with open world assumption. See hy_text2pool manual for further details.

Parameters:
negation -

cwa

public void cwa(boolean cwa)
Sets open world assumption (cwa = false) or closed world assumption (cwa = true). See hy_text2pool manual for further details.

Parameters:
cwa - flag if closed or open world assumption

recogniseStrings

public void recogniseStrings(boolean strings)
Whether to recognise strings or not. See hy_text2pool manual for further details.

Parameters:
strings -

recogniseNumbers

public void recogniseNumbers(boolean numbers)
Whether to recognise numbers or not. See hy_text2pool manual for further details.

Parameters:
numbers -

recogniseClassifications

public void recogniseClassifications(boolean classifications)
Whether to recognise classifications or not. See hy_text2pool manual for further details.

Parameters:
classifications -

recogniseRelationships

public void recogniseRelationships(boolean relationships)
Whether to recognise relationships or not. See hy_text2pool manual for further details.

Parameters:
relationships - true if relationships should be recognised

wordSep

public void wordSep(java.lang.String wordSep)
Regular expression of word separators. See hy_text2pool manual for further details.

Parameters:
wordSep -

skip

public void skip(java.lang.String skipRegex)
Skip signs and words matching the given regular expression. See hy_text2pool manual for further details.

Parameters:
skipRegex - the regular expression of words and signs to skip

minStringLength

public void minStringLength(int minStringLength)
Sets the minimum string length. See hy_text2pool manual for further details.

Parameters:
minStringLength -

maxStringLength

public void maxStringLength(int maxStringLength)
Sets the maximum string length. See hy_text2pool manual for further details.

Parameters:
maxStringLength -

minWordLength

public void minWordLength(int minWordLength)
Sets the minimum word length. See hy_text2pool manual for further details.

Parameters:
minWordLength -

maxWordLength

public void maxWordLength(int maxWordLength)
Sets the maximum word length. See hy_text2pool manual for further details.

Parameters:
maxWordLength -

wordRegex

public void wordRegex(java.lang.String wordRegex)
The regular expression for word recognition. If this option is set, wordSep() does not have any effect. See hy_text2pool manual for further details.

Parameters:
wordRegex -

numberRegex

public void numberRegex(java.lang.String numberRegex)
The regular expression for number recognition. See hy_text2pool manual for further details.

Parameters:
numberRegex -

stringRegex

public void stringRegex(java.lang.String stringRegex)
The regular expression for string recognition. See hy_text2pool manual for further details.

Parameters:
stringRegex -

negationRegex

public void negationRegex(java.lang.String negationRegex)
The regular expression for negation recognition. See hy_text2pool manual for further details.

Parameters:
negationRegex -

addTextFile

public void addTextFile(java.lang.String filename)

reset

public void reset()
Resets all parameters of the engine after destroying a possibly running process. You have to restart the process with run().

Overrides:
reset in class HyEngine

buildCommand

protected java.lang.String[] buildCommand()
Description copied from class: HyAnalysisEngine
Builds the command from the parameters. If subclasses support other parameters, they have to override the buildCommand and reset methods and also ensure that filenames are included. You can use the following code for this:
   for (Enumeration e = super.filenames.elements(); e.hasMoreElements();)
   {
      commandVec.add((String)e.nextElement());
   }
 
Be sure that you also place the support for new, additional parameters somewhere. This means the block
   if (this.argumentString != null) {
     StringTokenizer strTok= new StringTokenizer(this.argumentString);
     while (strTok.hasMoreTokens()) commandVec.add(strTok.nextToken());
  }
  
should appear somewhere in your buildCommand implementation.

The output of this method is used in the run() method.

Overrides:
buildCommand in class HyAnalysisEngine
Returns:
the command string array