jovie
#include <ssmlconvert.h>
Public Types | |
enum | TransformState { tsIdle = 0, tsTransforming = 1, tsFinished = 2 } |
Signals | |
void | transformFinished () |
Public Member Functions | |
SSMLConvert () | |
SSMLConvert (const QStringList &talkers) | |
virtual | ~SSMLConvert () |
QString | appropriateTalker (const QString &text) const |
QString | extractTalker (const QString &talkercode) |
QString | getOutput () |
int | getState () |
void | setTalkers (const QStringList &talkers) |
bool | transform (const QString &text, const QString &xsltFilename) |
Detailed Description
Definition at line 41 of file ssmlconvert.h.
Member Enumeration Documentation
Enumerator | |
---|---|
tsIdle | |
tsTransforming | |
tsFinished |
Definition at line 50 of file ssmlconvert.h.
Constructor & Destructor Documentation
SSMLConvert::SSMLConvert | ( | ) |
|
explicit |
Constructor. Set the talkers to be used as reference for entered text.
Definition at line 48 of file ssmlconvert.cpp.
|
virtual |
Destructor.
Definition at line 55 of file ssmlconvert.cpp.
Member Function Documentation
QString SSMLConvert::appropriateTalker | ( | const QString & | text | ) | const |
Returns the most appropriate talker for the text to synth's talker code.
Return the most appropriate talker for the text to synth talker code.
- Parameters
-
text the text that will be parsed.
- Returns
- the appropriate talker for the job as a talker code QString.
The appropriate talker is the one that has the most features that are required in some SSML markup. In the future I'm hoping to make the importance of individual features configurable, but better to walk before you can run. Currently, the searching method in place is like a filter: Those that meet the criteria we're searchin for stay while others are sifted out. This should leave us with the right talker to use. It's not a very good method, but should be appropriate in most cases and should do just fine for now.
See the implementation file for more detail.
- Parameters
-
text the text that will be parsed.
- Returns
- the appropriate talker for the job as a talker code.
The appropriate talker is the one that has the most features that are required in some SSML markup. In the future I'm hoping to make the importance of individual features configurable, but better to walk before you can run. Currently, the searching method in place is like a filter: Those that meet the criteria we're searchin for stay while others are sifted out. This should leave us with the right talker to use. It's not a very good method, but should be appropriate in most cases and should do just fine for now.
As it stands, here is the list of things that are looked for, in order of most importance:
- Language Obviously the most important. If a language is specified, look for the talkers that support it. Default to en (or some form of en - en_US, en_GB, etc). Only one language at a time is allowed at the moment, and must be specified in the root speak element (<speak xml:lang="en-US">)
- Gender If a gender is specified, look for talkers that comply. There is no default so if no gender is specified, no talkers will be removed. The only gender that will be searched for is the one specified in the root speak element. This should change in the future.
- Prosody Check if prosody modification is allowed by the talker. Currently this is hardcoded (it is stated which talkers do and do not in a variable somewhere).
Bear in mind that the XSL stylesheet that will be applied to the SSML is the same regardless of the how the talker is chosen, meaning that you don't lose some features of the talker if this search doesn't encompass them.
QDom is the item of choice for the matching. Just walk the tree..
Matches are stored here. Obviously to begin with every talker matches.
Check that this is (well formed) SSML and all our searching will not be in vain.
For each rule that we are looking through, iterate over all currently matching talkers and remove all the talkers that don't match.
Storage for talker code components.
Language searching
If it is set to en*, then match all english speakers. They all sound the same anyways.
Find all hits and place them in matches. We don't search for the closing " because if the talker emits lang="en-UK" or something we'll be ignoring it, which we don't want.
Gender searching If, for example, male is specified and only female is found, ignore the choice and just use female.
If the gender found is not 'male' or 'female' then ignore it.
Make sure that we don't strip away all the talkers because of no matches.
Prosody Search for talkers that allow modification of the synth output - louder, higher, slower, etc. There should be a direct way to query each synth to find out if this is supported (some function in PlugInConf), but for now, hardcode all the way :(
Known to support (feel free to add to the list and if search): Festival Int (not flite), Hadifix
Return the first match that complies. Maybe a discrete way to choose between all the matches could be offered in the future. Some form of preference.
Definition at line 106 of file ssmlconvert.cpp.
QString SSMLConvert::extractTalker | ( | const QString & | talkercode | ) |
Extract the synth name from a talker code (i.e festival, flite, freetts).
- Parameters
-
talkercode the talker code to extract the talker from.
- Returns
- the talker.
Definition at line 66 of file ssmlconvert.cpp.
QString SSMLConvert::getOutput | ( | ) |
Returns the output from call to transform.
Read back the data that was written to /tmp/fileName.output.
uhh yeah... Issues writing to the SSML file.
Definition at line 267 of file ssmlconvert.cpp.
int SSMLConvert::getState | ( | ) |
Returns current processing state.
Definition at line 262 of file ssmlconvert.cpp.
void SSMLConvert::setTalkers | ( | const QStringList & | talkers | ) |
Set the talker codes to be used.
Set the talkers to be used as reference for entered text.
- Parameters
-
talkers talker codes to be used.
Definition at line 62 of file ssmlconvert.cpp.
bool SSMLConvert::transform | ( | const QString & | text, |
const QString & | xsltFilename | ||
) |
Applies the spreadsheet for a talker to the SSML and returns the talker-native output.
- Parameters
-
text the markup to apply the spreadsheet to. xsltFilename the name of the stylesheet file that will be applied (i.e freetts, flite).
- Returns
- the output that the synth can understand.
This converts a piece of SSML into a format the given talker can understand. It applies an XSLT spreadsheet to the SSML and returns the output.
- Parameters
-
text The markup to apply the spreadsheet to. xsltFilename The name of the stylesheet file that will be applied (i.e freetts, flite).
- Returns
- False if an error occurs.
This converts a piece of SSML into a format the given talker can understand. It applies an XSLT spreadsheet to the SSML and returns the output.
Emits transformFinished signal when completed. Caller then calls getOutput to retrieve the transformed text.
Write
- Parameters
-
text to a temporary file.
Spawn an xsltproc process to apply our stylesheet to our SSML file.
Definition at line 206 of file ssmlconvert.cpp.
|
signal |
Emitted whenever tranforming is completed.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:32:26 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.