UNPKG

mtengines

Version:

Machine Translation (MT) library written in TypeScript

56 lines (55 loc) 2.23 kB
/******************************************************************************* * Copyright (c) 2023 - 2025 Maxprograms. * * This program and the accompanying materials * are made available under the terms of the Eclipse License 1.0 * which accompanies this distribution, and is available at * https://www.eclipse.org/org/documents/epl-v10.html * * Contributors: * Maxprograms - initial API and implementation *******************************************************************************/ import { OpenAI } from "openai"; import { XMLElement } from "typesxml"; import { MTEngine } from "./MTEngine"; import { MTMatch } from "./MTMatch"; export declare class ChatGPTTranslator implements MTEngine { static readonly GPT_41: string; static readonly GPT_41_MINI: string; static readonly GPT_41_NANO: string; static readonly GPT_4o: string; static readonly GPT_4o_MINI: string; static readonly GPT_4: string; static readonly GPT_4_TURBO: string; static readonly GPT_35_TURBO: string; static readonly GPT_o3: string; static readonly GPT_o1: string; static readonly GPT_o1_MINI: string; static readonly GPT_o1_PRO: string; static readonly GPT_o4_MINI: string; openai: OpenAI; srcLang: string; tgtLang: string; model: string; constructor(apiKey: string, model?: string); getName(): string; getShortName(): string; getSourceLanguages(): Promise<string[]>; getTargetLanguages(): Promise<string[]>; setSourceLanguage(lang: string): void; getSourceLanguage(): string; setTargetLanguage(lang: string): void; getTargetLanguage(): string; translate(source: string): Promise<string>; getMTMatch(source: XMLElement, terms: { source: string; target: string; }[]): Promise<MTMatch>; handlesTags(): boolean; getModels(): string[]; fixMatch(originalSource: XMLElement, matchSource: XMLElement, matchTarget: XMLElement): Promise<MTMatch>; fixTranslation(originalSource: XMLElement, matchSource: XMLElement, matchTarget: XMLElement): Promise<string>; fixesMatches(): boolean; fixesTags(): boolean; fixTags(source: XMLElement, target: XMLElement): Promise<XMLElement>; }