当前位置: 首页>>代码示例>>Java>>正文


Java MaryUtils.locale2xmllang方法代码示例

本文整理汇总了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>&lt;voice xml:lang="..."&gt;</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 + "'");
   }
 
开发者ID:HaraldBerthelsen,项目名称:marytts-lang-ar,代码行数:47,代码来源:TextToMaryXML.java

示例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()) + "\">";
}
 
开发者ID:ArticulatedSocialAgentsPlatform,项目名称:HmiCore,代码行数:6,代码来源:MaryTTSGenerator.java

示例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()) + "\">";
}
 
开发者ID:ArticulatedSocialAgentsPlatform,项目名称:HmiCore,代码行数:6,代码来源:MaryTTSGenerator.java

示例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()) + "\">";
}
 
开发者ID:ArticulatedSocialAgentsPlatform,项目名称:HmiCore,代码行数:5,代码来源:MaryTTSGenerator.java

示例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()) + "\">";
}
 
开发者ID:ArticulatedSocialAgentsPlatform,项目名称:HmiCore,代码行数:6,代码来源:MaryTTSGenerator.java


注:本文中的marytts.util.MaryUtils.locale2xmllang方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。