[mary-dev] Phonetic transcriptions
Fabio Tesser
fabio.tesser at gmail.com
Mon Nov 29 12:54:11 CET 2010
Hello,
Using the DatabaseSelector (point 6 of
http://mary.opendfki.de/wiki/NewLanguageSupport) I was thinking that
should be useful to have the phonetic transcriptions of the selected
sentences into a file (i.e. selected_transcriptions.log). This because
it should be useful to check the transcription of the selected
sentences. This should be also a like to have feature in the
SynthesisScriptGUI.
I would like to add this feature into the DatabaseSelector procedure in
the Italian branch.
For the moment I have write some a procedure that get the phonetic
transcription from maryserver using the MaryClient class.
The essential of this procedure is the following:
------
...
MaryClient mary = MaryClient.getMaryClient(new
Address(serverHost, serverPort));
...
ByteArrayOutputStream baos = new ByteArrayOutputStream();
mary.process(text, "TEXT", "ALLOPHONES", locale, null, null, baos);
...
// read into mary data object
MaryData maryData = new MaryData(MaryDataType.ALLOPHONES, null);
maryData.readFrom(new ByteArrayInputStream(baos.toByteArray()));
Document doc = maryData.getDocument();
...
TreeWalker phWalker = MaryDomUtils.createTreeWalker(doc, doc,
MaryXML.PHONE);
Element ph;
String lTranscription = "";
while ((ph = (Element) phWalker.nextNode()) != null) {
lTranscription = lTranscription + ph.getAttribute("p") + ' ';
}
...
------
I'm pretty new in OpenMary, and so I would like to know if others
simpler ways or other classes exist to obtain the phonetic transcription
of a sentence.
Thanks in advance,
Fabio.
More information about the Mary-dev
mailing list