本文整理汇总了Java中marytts.util.MaryUtils.locale2xmllang方法的典型用法代码示例。如果您正苦于以下问题:Java MaryUtils.locale2xmllang方法的具体用法?Java MaryUtils.locale2xmllang怎么用?Java MaryUtils.locale2xmllang使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类marytts.util.MaryUtils
的用法示例。
在下文中一共展示了MaryUtils.locale2xmllang方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: appendParagraph
import marytts.util.MaryUtils; //导入方法依赖的package包/类
/**
* Append one paragraph of text to the rawmaryxml document. If the text language (as determined by #getLanguage(text)) differs
* from the enclosing document's language, the paragraph element is enclosed with a <code><voice xml:lang="..."></code>
* element.
*
* @param text
* the paragraph text.
* @param root
* the root node of the rawmaryxml document, where to insert the paragraph.
* @param defaultLocale
* the default locale, in case the language of the text cannot be determined.
*/
private void appendParagraph(String text, Element root, Locale defaultLocale) throws Exception {
Element insertHere = root;
String rootLanguage = root.getAttribute("xml:lang");
String textLanguage = MaryUtils.locale2xmllang(determineLocale(text, defaultLocale));
if (!textLanguage.equals(rootLanguage)) {
Element voiceElement = MaryXML.appendChildElement(root, MaryXML.VOICE);
voiceElement.setAttribute("xml:lang", textLanguage);
insertHere = voiceElement;
}
// HB 151109 If the text is in Arabic script, change it to buckwalter
System.out.println("Input text on next line:");
System.out.println(text);
if ( containsArabic(text) ) {
if ( !isVocalised(text) ) {
text = vocaliseText(text);
}
text = arabicToBuckwalter(text);
}
System.out.println("Buckwalter text on next line:");
System.out.println(text);
insertHere = MaryXML.appendChildElement(insertHere, MaryXML.PARAGRAPH);
// Now insert the entire plain text as a single text node
insertHere.appendChild(root.getOwnerDocument().createTextNode(text));
// And, for debugging, read it:
Text textNode = (Text) insertHere.getFirstChild();
String textNodeString = textNode.getData();
logger.debug("textNodeString=`" + textNodeString + "'");
}
示例2: getSSMLStartTag
import marytts.util.MaryUtils; //导入方法依赖的package包/类
public synchronized String getSSMLStartTag()
{
return "<speak xmlns=\"http://www.w3.org/2001/10/synthesis\" xml:lang=\""
+ MaryUtils.locale2xmllang(voice.getLocale()) + "\">";
}
示例3: getMaryXMLStartTag
import marytts.util.MaryUtils; //导入方法依赖的package包/类
public synchronized String getMaryXMLStartTag()
{
return "<maryxml version=\"0.5\" xmlns=\"http://mary.dfki.de/2002/MaryXML\" xml:lang=\""
+ MaryUtils.locale2xmllang(voice.getLocale()) + "\">";
}
示例4: getSSMLStartTag
import marytts.util.MaryUtils; //导入方法依赖的package包/类
public synchronized String getSSMLStartTag()
{
return "<speak xmlns=\"http://www.w3.org/2001/10/synthesis\" xml:lang=\"" + MaryUtils.locale2xmllang(marytts.getLocale()) + "\">";
}
示例5: getMaryXMLStartTag
import marytts.util.MaryUtils; //导入方法依赖的package包/类
public synchronized String getMaryXMLStartTag()
{
return "<maryxml version=\"0.5\" xmlns=\"http://mary.dfki.de/2002/MaryXML\" xml:lang=\""
+ MaryUtils.locale2xmllang(marytts.getLocale()) + "\">";
}