public class Preprocess extends InternalModule
Modifier and Type | Field and Description |
---|---|
protected String |
cardinalRule |
protected String |
ordinalRule |
logger, state
MODULE_OFFLINE, MODULE_RUNNING
Constructor and Description |
---|
Preprocess() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkForNumbers(Document doc) |
protected String |
expandNumber(double number) |
protected String |
expandOrdinal(double number) |
protected static String |
getOrdinalRuleName(com.ibm.icu.text.RuleBasedNumberFormat rbnf)
Try to extract the rule name for "expand ordinal" from the given RuleBasedNumberFormat.
|
MaryData |
process(MaryData d)
Perform this module's processing on abstract "MaryData" input
d . |
getInputType, getLocale, getOutputType, getState, inputType, name, outputType, powerOnSelfTest, shutdown, startup
protected final String cardinalRule
protected final String ordinalRule
public MaryData process(MaryData d) throws Exception
InternalModule
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.
process
in interface MaryModule
process
in class InternalModule
d
- doutputType()
encapsulating the processing result.
This method just returns its input. Subclasses should override this.
Exception
- Exceptionprotected void checkForNumbers(Document doc)
protected String expandNumber(double number)
protected String expandOrdinal(double number)
protected static String getOrdinalRuleName(com.ibm.icu.text.RuleBasedNumberFormat rbnf)
The rule name is locale sensitive, but usually starts with "%spellout-ordinal".
rbnf
- The RuleBasedNumberFormat from where we will try to extract the rule name.Copyright © 2000–2016 DFKI GmbH. All rights reserved.