อัตโนมัติการแปลเอกสารโดยใช้โมเดล Google Gemini AI กับ Aspose.Words สำหรับ Java . แปลไฟล์ DOC, DOCX, RTF, PDF, HTML, Markdown, ODT, TXT และ EPUB เป็นภาษากว่า 300 ภาษา พร้อมรักษาเค้าโครงและรูปแบบเดิมของเอกสารไว้. เครื่องยนต์ที่ใช้ AI จะตรวจจับภาษาต้นฉบับโดยอัตโนมัติ — แม้ในเอกสารหลายภาษา — และจะไม่แปลเฉพาะส่วนที่ไม่สามารถระบุได้.
การรับรองความถูกต้องต้องใช้คีย์ API ของ Google. สำหรับรายการโมเดล 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 สำหรับ Java' เป็น JAR ทั่วไปที่มีโค้ดไบต์ โปรดปฏิบัติตาม คำแนะนำทีละขั้นตอน เกี่ยวกับวิธีการติดตั้งในสภาพแวดล้อมนักพัฒนา Java ของคุณ
Java SE 7 และ Java เวอร์ชันล่าสุด นอกจากนี้เรายังมีแพ็คเกจแยกต่างหากสำหรับ Java SE 6 ในกรณีที่คุณจำเป็นต้องใช้งาน JRE ล้าสมัยนี้
Java ของเราเป็นแบบข้ามแพลตฟอร์มและทำงานบนระบบปฏิบัติการทั้งหมดที่มีการใช้งาน JVM Microsoft Windows, Linux, macOS, Android และ iOS
สำหรับข้อมูลเกี่ยวกับการพึ่งพาแพ็คเกจเสริม เช่น JogAmp JOGL, Harfbuzz ฟอนต์ Java Advanced Imaging JAI โปรดดู เอกสารประกอบผลิตภัณฑ์