> This is a page from the ElevenLabs documentation. For a complete page index, fetch https://elevenlabs.io/docs/llms.txt. For the full documentation in a single file, fetch https://elevenlabs.io/docs/llms-full.txt.

# 文字起こしの編集

> **Note**
>
> **ハウツーガイド** · [Speech to Text クイックスタート](/docs/ja/eleven-api/guides/cookbooks/speech-to-text)を完了していることを前提としています。

## 概要

> **Warning**
>
> 文字起こしの編集は実験的機能であり、基本の文字起こし料金に加えて30%の追加料金がかかります。
> リクエストごとに最低10秒分のオーディオが課金対象です。詳しい料金については、[API 料金ページ](https://elevenlabs.io/pricing?price.section=speech_to_text\&price.sections=speech_to_text,speech_to_text#pricing-table)
> をご覧ください。

文字起こしの編集では、文字起こしリクエストに自然言語の指示を追加できます。オーディオの文字起こし後、その指示が文字起こしに適用され、元のテキストとともに編集済みテキストが返されます。

これにより、自前のパイプラインで個別に後処理を行う必要がなくなります。一般的な用途には、日付、時刻、単位の表記統一、略語の展開、不要なコンテンツの削除、スタイルやトーンの変更、文字起こしの再フォーマットなどがあります。

たとえば、`Write all dates in ISO 8601 format (YYYY-MM-DD)`という指示で留守番電話を文字起こしすると、両方のテキストバージョンが返されます。

```json maxLines=0
{
  "language_code": "eng",
  "language_probability": 0.9912,
  "text": "Hi, this is Jill. Your appointment is confirmed for the twelfth of July twenty twenty-six, and the follow-up is on the third of August.",
  "words": [
    { "text": "Hi,", "start": 0.12, "end": 0.38, "type": "word", "logprob": 0.0 },
    { "text": " ", "start": 0.38, "end": 0.41, "type": "spacing", "logprob": 0.0 },
    { "text": "this", "start": 0.41, "end": 0.55, "type": "word", "logprob": 0.0 },
    ...
  ],
  "transcription_id": "Y2ZX8AxHUzTPCIualYiE",
  "edited_transcript": {
    "kind": "transcript",
    "text": "Hi, this is Jill. Your appointment is confirmed for 2026-07-12, and the follow-up is on 2026-08-03."
  }
}
```

`text`フィールドと`words`フィールドは常に元の文字起こしを表します。編集済みバージョンは`edited_transcript`で別途返されます。

## 文字起こし編集の統合

文字起こしの編集は、`convert`メソッドに`transcript_edit`パラメータを渡すことでSpeech to Text APIに統合できます。指示は最大2000文字です。

```python maxLines=0
import os
from dotenv import load_dotenv
from elevenlabs.client import ElevenLabs

load_dotenv()

elevenlabs = ElevenLabs(
    api_key=os.getenv("ELEVENLABS_API_KEY"),
)

with open("voicemail.mp3", "rb") as audio_file:
    transcription = elevenlabs.speech_to_text.convert(
        file=audio_file,
        model_id="scribe_v2",
        # Natural-language instruction applied to the finished transcript.
        transcript_edit="Write all dates in ISO 8601 format (YYYY-MM-DD)",
    )

print("Original:", transcription.text)
print("Edited:", transcription.edited_transcript)
```

```typescript maxLines=0
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";
import "dotenv/config";
import { readFile } from "node:fs/promises";

const elevenlabs = new ElevenLabsClient({
  apiKey: process.env.ELEVENLABS_API_KEY,
});

const audioBlob = new Blob([await readFile("voicemail.mp3")], { type: "audio/mp3" });

const transcription = await elevenlabs.speechToText.convert({
  file: audioBlob,
  modelId: "scribe_v2",
  // Natural-language instruction applied to the finished transcript.
  transcriptEdit: "Write all dates in ISO 8601 format (YYYY-MM-DD)",
});

console.log("Original:", transcription.text);
console.log("Edited:", transcription.editedTranscript);
```

文字起こしの編集は、同期リクエストと[webhook](/docs/ja/eleven-api/guides/how-to/speech-to-text/batch/webhooks)リクエストの両方で利用できます。webhookリクエストでは、`edited_transcript`がwebhookペイロードの`transcription`オブジェクトに含まれます。

Scribe v2 Realtimeでは、確定した各文字起こしに同じ指示を適用できます。詳しくは、[リアルタイム文字起こし編集ガイド](/docs/ja/eleven-api/guides/how-to/speech-to-text/realtime/transcript-editing)をご覧ください。

## 指示の書き方

指示は、関連する箇所すべてで文字起こし全体に適用され、最初の一致箇所だけでなく、すべての一致箇所が編集されます。指示では特定の単語やフレーズのみを変更して他をそのままにしたり、テキスト全体を書き換えたり注釈を追加したりできます。1つの指示で複数の編集を組み合わせることもできます。

以下の例は、対応している指示の範囲を示しています。

| 指示                                                                                                      | 効果                                                                                  |
| ------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
| `Write all dates in ISO 8601 format (YYYY-MM-DD)`                                                       | `the twelfth of July twenty twenty-six`が`2026-07-12`になる                             |
| `Write times in 24-hour format`                                                                         | `half past two in the afternoon`が`14:30`になる                                         |
| `Expand abbreviations such as "ETA" and "ASAP" on first use`                                            | `ETA`が`estimated time of arrival (ETA)`になる                                          |
| `Add the sentiment of every sentence in brackets at the end. Choose from [positive, negative, neutral]` | `Thanks, that was really helpful.`が`Thanks, that was really helpful. [positive]`になる |
| `Redact every curse word with its first letter followed by stars, e.g. s***`                            | `That was a damn good call.`が`That was a d*** good call.`になる                        |
| `Format the transcript as a bulleted list, one sentence per bullet`                                     | 文字起こし全体を箇条書きに再フォーマット                                                                |

> **Note**
>
> 一部の調整には、編集指示よりも安価で予測しやすい専用パラメータがあります。特定の名前や用語の認識を
> 優先させるには[keyterm prompting](/docs/ja/eleven-api/guides/how-to/speech-to-text/batch/keyterm-prompting)、フィラーワードや
> 非流暢な発話を削除するには`no_verbatim`、数字と単語のどちらを使用するか選ぶには（対応している場合）
> `numbers_format`を使用してください。これらのオプションで対応できない変更には、文字起こしの編集を使用してください。

指示を作成する際は、次の点に留意してください。

* 求める出力を明確に指定してください。`Write all dates in ISO 8601 format (YYYY-MM-DD)`は、`fix the dates`よりも信頼性があります。
* 指示はどの言語でも記述できますが、英語で書かれた指示が最も効果的です。編集済み文字起こしは元の言語のままです。
* 実行されるのは指示のみです。オーディオ内で発話された内容はデータとして扱われ、指示の適用方法を変更することはできません。
* 文字起こし内に指示の影響を受ける箇所がない場合、編集済み文字起こしは元のものと同一です。

## レスポンス形式

`transcript_edit`を設定すると、レスポンスには`edited_transcript`オブジェクトが含まれます。その`kind`フィールドは、編集が成功したかどうかを示します。

| `kind`       | フィールド                                 | 説明                                               |
| ------------ | ------------------------------------- | ------------------------------------------------ |
| `transcript` | `text`                                | 編集済み文字起こし。編集が行われなかった場合は元の`text`と同一です。            |
| `error`      | `error_type`（`edit_failed`）、`message` | 編集を生成できませんでした。文字起こし自体は成功しており、元の`text`は引き続き返されます。 |

`transcript_edit`がリクエストされていない場合、このフィールドは存在しません。

**`Failed edit`**

```json title="Failed edit"
{
  "text": "Hi, this is Jill. Your appointment is confirmed for ...",
  "edited_transcript": {
    "kind": "error",
    "error_type": "edit_failed",
    "message": "The transcript could not be edited. Please try again."
  }
}
```

注意すべき動作：

* 編集済み文字起こしはプレーンテキストです。単語レベルのタイムスタンプ、話者ラベル、`additional_formats`は引き続き元の文字起こしを表します。
* 編集は文字起こしの完了後に実行されるため、文字起こしの長さに応じてレイテンシーが増加します。
* 追加料金はリクエストのオーディオ時間に適用され、リクエストごとに最低10秒分が課金されます。

> **Warning**
>
> 文字起こしの編集は、`entity_detection`、`entity_redaction`、`use_multi_channel`と組み合わせることはできません。
> これらを組み合わせたリクエストは、無効なパラメータエラーで拒否されます。

## 次のステップ

#### [APIリファレンス](/docs/ja/api-reference/speech-to-text)

Speech to Text APIの完全なリファレンスとパラメータ。

#### [Webhook](/docs/ja/eleven-api/guides/how-to/speech-to-text/batch/webhooks)

編集済み文字起こしを含む文字起こしを、webhook経由で非同期に受け取ります。