public class Phonemiser extends InternalModule
Modifier and Type | Field and Description |
---|---|
protected AllophoneSet |
allophoneSet |
protected FSTLookup |
lexicon |
protected Map<String,List<String>> |
userdict |
logger, state
MODULE_OFFLINE, MODULE_RUNNING
Constructor and Description |
---|
Phonemiser(String propertyPrefix) |
Phonemiser(String componentName,
MaryDataType inputType,
MaryDataType outputType,
String allophonesProperty,
String userdictProperty)
Constructor providing the individual filenames of files that are required.
|
Modifier and Type | Method and Description |
---|---|
String |
phonemise(String text,
String pos,
StringBuilder g2pMethod)
Phonemise the word text.
|
MaryData |
process(MaryData d)
Perform this module's processing on abstract "MaryData" input
d . |
protected Map<String,List<String>> |
readLexicon(String lexiconFilename)
Read a lexicon.
|
protected void |
setPh(Element t,
String ph) |
String |
userdictLookup(String text,
String pos)
look a given text up in the userdict.
|
getInputType, getLocale, getOutputType, getState, inputType, name, outputType, powerOnSelfTest, shutdown, startup
protected FSTLookup lexicon
protected AllophoneSet allophoneSet
public Phonemiser(String propertyPrefix) throws IOException, SAXException, ParserConfigurationException, MaryConfigurationException
public Phonemiser(String componentName, MaryDataType inputType, MaryDataType outputType, String allophonesProperty, String userdictProperty) throws IOException, SAXException, ParserConfigurationException, MaryConfigurationException
componentName
- componentNameinputType
- inputTypeoutputType
- outputTypeallophonesProperty
- allophonesPropertyuserdictProperty
- userdictPropertyIOException
- IOExceptionSAXException
- SAXExceptionParserConfigurationException
- ParserConfigurationExceptionMaryConfigurationException
- MaryConfigurationExceptionpublic 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
- Exceptionpublic String phonemise(String text, String pos, StringBuilder g2pMethod) throws IOException
text
- the textual (graphemic) form of a word.pos
- the part-of-speech of the wordg2pMethod
- This is an awkward way to return a second String parameter via a StringBuilder. If a phonemisation of the text
is found, this parameter will be filled with the method of phonemisation ("lexicon", ... "rules").IOException
- IOExceptionpublic String userdictLookup(String text, String pos)
text
- textpos
- posprotected Map<String,List<String>> readLexicon(String lexiconFilename) throws IOException
lexiconFilename
- lexiconFilenameIOException
- IOExceptionCopyright © 2000–2016 DFKI GmbH. All rights reserved.