Google Gemini AI モデルと Aspose.Words for Java を使用して文書翻訳を自動化します。DOC、DOCX、RTF、PDF、HTML、Markdown、ODT、TXT、EPUB ファイルを 300 以上の言語に翻訳し、元のレイアウトと書式を保持します。AI ベースのエンジンはソース言語を自動的に検出し(多言語文書でも)、認識できないフラグメントだけを未翻訳のまま残します。
認証には Google API キーが必要です。サポートされている AI モデルの全リストは、API リファレンスをご覧ください。
Java で今日から文書の翻訳を開始しましょう — 上記のライブデモをご体験ください。
// Repository path: https://releases.aspose.com/java/repo/
// Maven, where 'ver' - Aspose.Words version number, for example, 24.4.
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-words</artifactId>
<version>ver</version>
<classifier>jdk17</classifier>
</dependency>
コピー
// Repository path: https://releases.aspose.com/java/repo/
// Gradle, where 'ver' - Aspose.Words version number, for example, 24.4.
compile(group: 'com.aspose', name: 'aspose-words', version: 'ver', classifier: 'jdk17')
コピー
// Repository path: https://releases.aspose.com/java/repo/
// Ivy, where 'ver' - Aspose.Words version number, for example, 24.4.
<dependency org="com.aspose" name="aspose-words" rev="ver">
<artifact name="aspose-words" m:classifier="jdk17" ext="jar"/>
</dependency>
コピー
// Repository path: https://releases.aspose.com/java/repo/
// Sbt, where 'ver' - Aspose.Words version number, for example, 24.4.
libraryDependencies += "com.aspose" % "aspose-words" % "ver"
コピー
Document doc = new Document("Document.docx");
String apiKey = System.getenv("API_KEY");
// Google の生成言語モデルを使用します。
AiModel model = AiModel.create(AiModelType.GEMINI_FLASH_LATEST).withApiKey(apiKey);
Document translatedDoc = model.translate(doc, Language.ARABIC);
translatedDoc.save("Output.docx")
Document doc = new Document("Document.docx");
// Pass an empty string if the self-hosted model does not require an API key.
AiModel model = new CustomAiModel().withApiKey("");
Document translatedDoc = model.translate(doc, Language.Arabic);
translatedDoc.save("Output.docx")
static class CustomAiModel extends OpenAiModel
{
protected String getUrl() { return "https://your-server.com/v1"; }
protected String getName() { return "my-model-24b"; }
}
Java パッケージはMavenリポジトリでホストします。 'Aspose.Words for Java' は、バイトコードを含む一般的な JAR Java開発者環境にインストールする方法のステップバイステップの説明に従ってください。
Java SE 7 Java バージョンがサポートされています。 JRE を使用する必要がある場合に備えて Java SE 6 用の個別のパッケージも提供しています。
私たちの Java Microsoft Windows 、Linux、macOS、Android、iOS JVM 実装されているすべてのオペレーティングシステムで実行されます。
JogAmp JOGL 、 Harfbuzz フォントエンジン、 Java Advanced Imaging JAI などのオプションのパッケージ依存関係については、製品ドキュメントを参照してください。