mtengines
Version:
Machine Translation (MT) library written in TypeScript
51 lines (50 loc) • 2.05 kB
TypeScript
/*******************************************************************************
* 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 Anthropic from '@anthropic-ai/sdk';
import { XMLElement } from "typesxml";
import { MTEngine } from "./MTEngine";
import { MTMatch } from "./MTMatch";
export declare class AnthropicTranslator implements MTEngine {
static readonly CLAUDE_OPUS_4: string;
static readonly CLAUDE_SONNET_4: string;
static readonly CLAUDE_SONNET_3_7: string;
static readonly CLAUDE_HAIKU_3_5: string;
static readonly CLAUDE_SONNET_3_5: string;
static readonly CLAUDE_HAIKU_3_0: string;
static readonly CLAUDE_SONNET_3_0: string;
static readonly CLAUDE_OPUS_3_0: string;
model: string;
anthropic: Anthropic;
srcLang: string;
tgtLang: string;
constructor(apiKey: string, model?: string);
getName(): string;
getShortName(): string;
getModels(): 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>;
createMessage(source: string): Promise<Anthropic.Message>;
handlesTags(): boolean;
fixesMatches(): boolean;
fixMatch(originalSource: XMLElement, matchSource: XMLElement, matchTarget: XMLElement): Promise<MTMatch>;
fixesTags(): boolean;
fixTags(source: XMLElement, target: XMLElement): Promise<XMLElement>;
}