Google Transliteration API:如何获取输入并将输出保存在文本文件中?

时间:2023-01-10 09:51:57

Greetings All;

I need to use google translitrate api in a java application.

我需要在java应用程序中使用google translitrate api。

What I have done till now is to import the sample in the library "gwt-language-1.1.0" that called "hellolanguage" in the netbeans, then I added the required libraries/jars.

到目前为止,我所做的是在netbeans中名为“hellolanguage”的库“gwt-language-1.1.0”中导入样本,然后我添加了所需的库/ jar。

It worked fine like this demo: hellolanguage Demo but on my localhost.

它像这个演示一样工作正常:hellolanguage Demo但在我的localhost上。

what I want to do is to transliterate data from "inputfile.txt" for example and put the output in an "outputfile.txt".

我想要做的是例如从“inputfile.txt”音译数据并将输出放在“outputfile.txt”中。

I don't know how to implement this idea?

我不知道如何实现这个想法?

I'll be glad if you help me.

如果你帮助我,我会很高兴的。

Best regards;

1 个解决方案

#1


0  

You'll want to take a look at the Java IO API, for which there is a good tutorial at Oracle. This part of the tutorial will be particularly useful, and should provide some cut-and-pasteable code.

您将需要查看Java IO API,其中有一个很好的Oracle教程。本教程的这一部分将特别有用,并应提供一些可剪切和可粘贴的代码。

You can find a good Google Transliteration API example here. You'll want to add your custom code in the part of the code that looks like this:

您可以在此处找到一个好的Google Transliteration API示例。您将要在代码中看起来像这样的部分添加自定义代码:

new TransliterationCallback() {

@Override
protected void onCallback(TransliterationResult result) {
// your code here
}

});

#1


0  

You'll want to take a look at the Java IO API, for which there is a good tutorial at Oracle. This part of the tutorial will be particularly useful, and should provide some cut-and-pasteable code.

您将需要查看Java IO API,其中有一个很好的Oracle教程。本教程的这一部分将特别有用,并应提供一些可剪切和可粘贴的代码。

You can find a good Google Transliteration API example here. You'll want to add your custom code in the part of the code that looks like this:

您可以在此处找到一个好的Google Transliteration API示例。您将要在代码中看起来像这样的部分添加自定义代码:

new TransliterationCallback() {

@Override
protected void onCallback(TransliterationResult result) {
// your code here
}

});