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

# XSpeechToTextBeginHypothesisString

> XSpeechToTextBeginHypothesisString

# XSpeechToTextBeginHypothesisString

仮説を開始し、その文字列をテキスト オーバーレイに表示します。

## 構文

```cpp theme={null}
HRESULT XSpeechToTextBeginHypothesisString(  
         const char* speakerName,  
         const char* content,  
         XSpeechToTextType type,  
         uint32_t* hypothesisId  
)  
```

### パラメーター

*speakerName*   \_In\_z\_\
型: char\*

仮説文字列と共に表示される話者の名前です。

*content*   \_In\_z\_\
型: char\*

初期の仮説文字列です。

*type*   \_In\_\
型: [XSpeechToTextType](https://docs.xbox.com/ja-jp/reference/system/xaccessibility/enums/xspeechtotexttype.md)

仮説文字列のソース タイプです。

*hypothesisId*   \_Out\_\
型: uint32\_t\*

仮説の ID です。

### 戻り値

型: HRESULT

HRESULT の成功またはエラー コードです。

## 解説

仮説とは、話者が発話している内容を推測したもので、通常は話者が発話の途中にある間に音声認識エンジンによって生成されます。 音声テキスト変換オーバーレイ API は、ゲーム サーフェス上に仮説文字列を表示できます。

音声テキスト変換オーバーレイ API は、入力されたテキストもサポートしています。 *type* パラメーターは仮説文字列のソースを識別します。

アプリは、仮説が確定またはキャンセルされるまで、*hypothesisId* の値を保持する必要があります。

オーバーレイの仮説文字列を更新するには、[XSpeechToTextUpdateHypothesisString](https://docs.xbox.com/ja-jp/reference/system/xaccessibility/functions/xspeechtotextupdatehypothesisstring.md) を使用します。

仮説をキャンセルしてオーバーレイから削除するには、[XSpeechToTextCancelHypothesisString](https://docs.xbox.com/ja-jp/reference/system/xaccessibility/functions/xspeechtotextcancelhypothesisstring.md) を使用します。

仮説を確定するには、[XSpeechToTextFinalizeHypothesisString](https://docs.xbox.com/ja-jp/reference/system/xaccessibility/functions/xspeechtotextfinalizehypothesisstring.md) を使用します。

一部のプラットフォームでは、アプリが `XSpeechToTextFinalizeHypothesisString` を呼び出すまで仮説文字列は表示されません。 仮説がキャンセルされない限り、文字列が確実に表示されるように、アプリは常に `XSpeechToTextFinalizeHypothesisString` を呼び出す必要があります。

次のコード例は、アプリが仮説を作成し、更新し、確定する方法を示しています。

```cpp theme={null}
void RowanHypothesisSample() 
{ 
    UINT32 hypothesisId; 
    XSpeechToTextBeginHypothesisString("Rowan", "I am typing some text.", XSpeechToTextType::Text, &hypothesisId); 
 
    // Some time passes. 
 
    XSpeechToTextUpdateHypothesisString(hypothesisId, "I am still typing some text."); 
 
    // Some time passes. 
 
    XSpeechToTextFinalizeHypothesisString(hypothesisId, "I typed some text. I am done typing."); 
} 
```

次のコード例は、アプリが仮説を作成し、更新し、キャンセルする方法を示しています。

```cpp theme={null}
void QuincyHypothesisSample() 
{ 
    UINT32 hypothesisId; 
    XSpeechToTextBeginHypothesisString("Quincy", "I am speaking some text.", XSpeechToTextType::Voice, &hypothesisId); 
 
    // Some time passes. 
 
    XSpeechToTextUpdateHypothesisString(hypothesisId, "I am still speaking some text."); 
 
    // Some time passes. 
 
    XSpeechToTextCancelHypothesisString(hypothesisId); 
} 
```

## 要件

**ヘッダー:** XAccessibility.h

**ライブラリ:** xgameruntime.lib

**サポートされているプラットフォーム:** Windows、XBOX One ファミリー本体、XBOX Series 本体

## 関連項目

[XAccessibility](https://docs.xbox.com/ja-jp/reference/system/xaccessibility/xaccessibility_members.md)


## Related topics

- [XSpeechToTextCancelHypothesisString](https://docs.xbox.com/ja-jp/reference/system/xaccessibility/functions/xspeechtotextcancelhypothesisstring.md)
- [XSpeechToTextUpdateHypothesisString](https://docs.xbox.com/ja-jp/reference/system/xaccessibility/functions/xspeechtotextupdatehypothesisstring.md)
- [XSpeechToTextFinalizeHypothesisString](https://docs.xbox.com/ja-jp/reference/system/xaccessibility/functions/xspeechtotextfinalizehypothesisstring.md)
- [XAccessibility (API の内容)](https://docs.xbox.com/ja-jp/reference/system/xaccessibility/xaccessibility_members.md)
- [Unity プロジェクトでの GDK API 用 C# ラッパーの使用](https://docs.xbox.com/ja-jp/build/gdk-and-engines/unity/unity-api-wrappers.md)
