/** * 翻訳してはいけない断片(コード片・インラインタグ・URL)を * 形式のトークンに置き換えて保護する。 * * 翻訳エンジン(LLM / 機械翻訳モデル)にはトークン入りのテキストを渡し、 * 訳文の対応する位置にトークンをそのまま残してもらう。書き戻し時に * restoreText で復元する。 * * トークン形式は NLLB-200(yakudoc-mt の既定モデル)で生存確認済みのもの。 * ⟦n⟧ や [[n]] は機械翻訳モデルに壊されることがあり使えない。 */ /** n 番目の保護トークン。エラー報告などの表示にも使う */ export declare function placeholderToken(index: number): string; export interface ProtectedText { /** トークンに置き換え済みのテキスト */ text: string; /** トークン番号 → 元の断片 */ placeholders: string[]; } export declare function protectText(original: string): ProtectedText; export interface RestoredText { text: string; /** 訳文中に見つからなかったトークン番号。1 つでもあれば訳文は採用しない */ missing: number[]; } export declare function restoreText(translated: string, placeholders: string[]): RestoredText;