marytts.modules
Class TextToMaryXML

java.lang.Object
  extended by marytts.modules.InternalModule
      extended by marytts.modules.TextToMaryXML
All Implemented Interfaces:
MaryModule

public class TextToMaryXML
extends InternalModule

Embed plain text input into a raw (untokenised) MaryXML document.

Author:
Marc Schröder

Field Summary
 
Fields inherited from class marytts.modules.InternalModule
logger, state
 
Fields inherited from interface marytts.modules.MaryModule
MODULE_OFFLINE, MODULE_RUNNING
 
Constructor Summary
TextToMaryXML()
           
 
Method Summary
protected  java.util.Locale determineLocale(java.lang.String text, java.util.Locale defaultLocale)
          Try to determine the locale of the given text.
 MaryData process(MaryData d)
          Perform this module's processing on abstract "MaryData" input d.
 void startup()
          Allow the module to start up, performing whatever is necessary to become operational.
 
Methods inherited from class marytts.modules.InternalModule
getLocale, getState, inputType, name, outputType, powerOnSelfTest, shutdown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextToMaryXML

public TextToMaryXML()
Method Detail

startup

public void startup()
             throws java.lang.Exception
Description copied from interface: MaryModule
Allow the module to start up, performing whatever is necessary to become operational. After successful completion, getState() should return MODULE_RUNNING.

Specified by:
startup in interface MaryModule
Overrides:
startup in class InternalModule
Throws:
java.lang.Exception

process

public MaryData process(MaryData d)
                 throws java.lang.Exception
Description copied from class: InternalModule
Perform this module's processing on abstract "MaryData" input d. Subclasses need to make sure that the process() method is thread-safe, because in server-mode, it will be called from different threads at the same time. A sensible way to do this seems to be not to use any global or static variables, or to use them read-only.

Specified by:
process in interface MaryModule
Overrides:
process in class InternalModule
Returns:
A MaryData object of type outputType() encapsulating the processing result.

This method just returns its input. Subclasses should override this.

Throws:
java.lang.Exception

determineLocale

protected java.util.Locale determineLocale(java.lang.String text,
                                           java.util.Locale defaultLocale)
Try to determine the locale of the given text. This implementation simply returns the default locale; subclasses can try to do something fancy here.

Parameters:
text - the text whose locale to determine
defaultLocale - the default locale of the document.
Returns:
the locale as inferred from the text and the default locale