Google Gemini AI モデルと Aspose.Words for Node.js via .NET を使用して文書翻訳を自動化します。DOC、DOCX、RTF、PDF、HTML、Markdown、ODT、TXT、EPUB ファイルを 300 以上の言語に翻訳し、元のレイアウトと書式を保持します。AI ベースのエンジンはソース言語を自動的に検出し(多言語文書でも)、認識できないフラグメントだけを未翻訳のまま残します。
認証には Google API キーが必要です。サポートされている AI モデルの全リストは、API リファレンスをご覧ください。
JavaScript で今日から文書の翻訳を開始しましょう — 上記のライブデモをご体験ください。
npm install @aspose/words
コピー
const aw = require('@aspose/words');
const doc = new aw.Document("Document.docx");
const apiKey = process.env.API_KEY;
// Google の生成言語モデルを使用します。
const model = aw.AI.AiModel.createGemini15Flash();
model.setApiKey(apiKey);
const translatedDoc = model.translate(doc, aw.AI.Language.Arabic);
translatedDoc.save("Output.docx");
const aw = require('@aspose/words');
const doc = new aw.Document("Document.docx");
// Pass an empty string if the self-hosted model does not require an API key.
const model = new CustomAiModel("my-model-24b", "https://your-server.com/v1");
model.setApiKey("");
const translatedDoc = model.translate(doc, aw.AI.Language.Arabic);
translatedDoc.save("Output.docx");
class CustomAiModel extends aw.AI.OpenAiModel {
constructor(name, url) {
super(name);
this._url = url;
}
get url() {
return this._url;
}
}
We host our Node.js via .Net packages in NPM repositories. Please follow the step-by-step instructions on how to install "Aspose.Words for Node.js via .NET" to your developer environment.
This package is compatible with Node.js 14.17.0 or higher.