本文整理了Java中org.apache.tika.language.translate.YandexTranslator.translate()
方法的一些代码示例,展示了YandexTranslator.translate()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YandexTranslator.translate()
方法的具体详情如下:
包路径:org.apache.tika.language.translate.YandexTranslator
类名称:YandexTranslator
方法名:translate
暂无
代码示例来源:origin: apache/tika
@Override
public String translate(String text, String targetLanguage)
throws TikaException, IOException {
return this.translate(text, null, targetLanguage);
}
代码示例来源:origin: apache/tika
@Test
public void test2UNDEFINED_DE_ES_Translation() {
String inputText = "Guten Tag!!!";
String expectedText = "Buen Día!!!";
try{
String transText = translator.translate(inputText, "es");
assertNotNull("Text not translated", transText);
assumeTrue(expectedText.equals(transText));
}
catch(TikaException e){
e.printStackTrace();
fail(e.getMessage());
}
catch(IOException e){
e.printStackTrace();
fail(e.getMessage());
}
}
代码示例来源:origin: apache/tika
@Test
public void test1EN_ES_Translation() {
String inputText = "Hello World!!!";
String expectedText = "Hola Mundo!!!";
try{
String transText = translator.translate(inputText, "en", "es");
assertNotNull("Text not translated", transText);
assumeTrue(expectedText.equals(transText));
}
catch(TikaException e){
e.printStackTrace();
fail(e.getMessage());
}
catch(IOException e){
e.printStackTrace();
fail(e.getMessage());
}
}
代码示例来源:origin: apache/tika
@Test
public void test3UNDEFINED_IT_EN_Translation() {
String inputText = "Buona Sera!!!";
String expectedText = "Good Evening!!!";
try{
String transText = translator.translate(inputText, "en");
assertNotNull("Text not translated", transText);
assumeTrue(expectedText.equals(transText));
}
catch(TikaException e){
e.printStackTrace();
fail(e.getMessage());
}
catch(IOException e){
e.printStackTrace();
fail(e.getMessage());
}
}
代码示例来源:origin: org.apache.tika/tika-translate
@Override
public String translate(String text, String targetLanguage)
throws TikaException, IOException {
return this.translate(text, null, targetLanguage);
}
内容来源于网络,如有侵权,请联系作者删除!