> ## Documentation Index
> Fetch the complete documentation index at: https://kawax.biz/llms.txt
> Use this file to discover all available pages before exploring further.

# テキストからアクセント句を得る

> テキストからアクセント句を得ます。

is_kanaが`true`のとき、テキストは次のAquesTalk 風記法で解釈されます。デフォルトは`false`です。
* 全てのカナはカタカナで記述される
* アクセント句は`/`または`、`で区切る。`、`で区切った場合に限り無音区間が挿入される。
* カナの手前に`_`を入れるとそのカナは無声化される
* アクセント位置を`'`で指定する。全てのアクセント句にはアクセント位置を1つ指定する必要がある。
* アクセント句末に`？`(全角)を入れることにより疑問文の発音ができる。
enable_katakana_englishが`true`のとき、テキスト中の読みが不明な英単語をカタカナ読みにします。デフォルトは`true`です。
is_kanaが`true`のとき、enable_katakana_englishの値は無視されます。

**Laravel実装状況**: ⚠️ is_kanaのtrue/false両対応、enable_katakana_english非対応（フォールバック実装済み）



## OpenAPI

````yaml https://raw.githubusercontent.com/invokable/laravel-voicevox/refs/heads/main/docs/jp/laravel-openapi.json post /accent_phrases
openapi: 3.1.0
info:
  title: VOICEVOX ENGINE OSS
  description: VOICEVOX OSS の音声合成エンジンです。
  version: latest
servers: []
security: []
paths:
  /accent_phrases:
    post:
      tags:
        - クエリ編集
      summary: テキストからアクセント句を得る
      description: >-
        テキストからアクセント句を得ます。


        is_kanaが`true`のとき、テキストは次のAquesTalk 風記法で解釈されます。デフォルトは`false`です。

        * 全てのカナはカタカナで記述される

        * アクセント句は`/`または`、`で区切る。`、`で区切った場合に限り無音区間が挿入される。

        * カナの手前に`_`を入れるとそのカナは無声化される

        * アクセント位置を`'`で指定する。全てのアクセント句にはアクセント位置を1つ指定する必要がある。

        * アクセント句末に`？`(全角)を入れることにより疑問文の発音ができる。

        enable_katakana_englishが`true`のとき、テキスト中の読みが不明な英単語をカタカナ読みにします。デフォルトは`true`です。

        is_kanaが`true`のとき、enable_katakana_englishの値は無視されます。


        **Laravel実装状況**: ⚠️
        is_kanaのtrue/false両対応、enable_katakana_english非対応（フォールバック実装済み）
      operationId: accent_phrases
      parameters:
        - name: text
          in: query
          required: true
          schema:
            type: string
            title: Text
        - name: speaker
          in: query
          required: true
          schema:
            type: integer
            title: Speaker
        - name: is_kana
          in: query
          required: false
          schema:
            type: boolean
            default: false
            title: Is Kana
        - name: enable_katakana_english
          in: query
          required: false
          schema:
            type: boolean
            default: true
            title: Enable Katakana English
        - name: core_version
          in: query
          required: false
          schema:
            type: string
            title: Core Version
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/AccentPhrase'
                title: Response Accent Phrases Accent Phrases Post
        '400':
          description: 読み仮名のパースに失敗
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ParseKanaBadRequest'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    AccentPhrase:
      properties:
        moras:
          items:
            $ref: '#/components/schemas/Mora'
          type: array
          title: Moras
          description: モーラのリスト
        accent:
          type: integer
          title: Accent
          description: アクセント箇所
        pause_mora:
          $ref: '#/components/schemas/Mora'
          title: Pause Mora
          description: アクセント句の末尾につく無音モーラ。null の場合は無音モーラを付けない。
        is_interrogative:
          type: boolean
          title: Is Interrogative
          description: 疑問系かどうか
          default: false
      type: object
      required:
        - moras
        - accent
      title: AccentPhrase
      description: アクセント句ごとの情報。
    ParseKanaBadRequest:
      properties:
        text:
          type: string
          title: Text
          description: エラーメッセージ
        error_name:
          type: string
          title: Error Name
          description: |-
            エラー名

            |name|description|
            |---|---|
            | UNKNOWN_TEXT | 判別できない読み仮名があります: {text} |
            | ACCENT_TOP | 句頭にアクセントは置けません: {text} |
            | ACCENT_TWICE | 1つのアクセント句に二つ以上のアクセントは置けません: {text} |
            | ACCENT_NOTFOUND | アクセントを指定していないアクセント句があります: {text} |
            | EMPTY_PHRASE | {position}番目のアクセント句が空白です |
            | INTERROGATION_MARK_NOT_AT_END | アクセント句末以外に「？」は置けません: {text} |
            | INFINITE_LOOP | 処理時に無限ループになってしまいました...バグ報告をお願いします。 |
        error_args:
          additionalProperties:
            type: string
          type: object
          title: Error Args
          description: エラーを起こした箇所
      type: object
      required:
        - text
        - error_name
        - error_args
      title: ParseKanaBadRequest
      description: 読み仮名のパースに失敗した。
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    Mora:
      properties:
        text:
          type: string
          title: Text
          description: 文字
        consonant:
          type: string
          title: Consonant
          description: 子音の音素
        consonant_length:
          type: number
          title: Consonant Length
          description: 子音の長さ
        vowel:
          type: string
          title: Vowel
          description: 母音の音素
        vowel_length:
          type: number
          title: Vowel Length
          description: 母音の長さ
        pitch:
          type: number
          title: Pitch
          description: 音高
      type: object
      required:
        - text
        - vowel
        - vowel_length
        - pitch
      title: Mora
      description: モーラ（子音＋母音）ごとの情報。
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````