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

# XSpeechToTextBeginHypothesisString

> XSpeechToTextBeginHypothesisString

# XSpeechToTextBeginHypothesisString

Begins a hypothesis and displays its string in a text overlay.

<a id="syntaxSection" />

## Syntax

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

<a id="parametersSection" />

### Parameters

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

The name of the speaker to be displayed with the hypothesis string.

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

The initial hypothesis string.

*type*   \_In\_\
Type: [XSpeechToTextType](/reference/system/xaccessibility/enums/xspeechtotexttype)

The source type of the hypothesis string.

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

The ID of the hypothesis.

<a id="retvalSection" />

### Return value

Type: HRESULT

HRESULT success or error code.

<a id="remarksSection" />

## Remarks

A hypothesis is a guess at what a speaker is saying, typically produced by a speech recognizer while the speaker is in mid-phrase. The speech-to-text overlay API can display a hypothesis string over a game surface.

The speech-to-text overlay API also supports typed text. The *type* parameter identifies the source of the hypothesis string.

The app is responsible for retaining the value of *hypothesisId* until the hypothesis is either finalized or canceled.

To update a hypothesis string in the overlay, use [XSpeechToTextUpdateHypothesisString](/reference/system/xaccessibility/functions/xspeechtotextupdatehypothesisstring).

To cancel a hypothesis and remove it from the overlay, use [XSpeechToTextCancelHypothesisString](/reference/system/xaccessibility/functions/xspeechtotextcancelhypothesisstring).

To finalize a hypothesis, use [XSpeechToTextFinalizeHypothesisString](/reference/system/xaccessibility/functions/xspeechtotextfinalizehypothesisstring).

On some platforms, the hypothesis string is not displayed until the app calls `XSpeechToTextFinalizeHypothesisString`. Unless the hypothesis is canceled, your app must always call `XSpeechToTextFinalizeHypothesisString` to ensure that the string is displayed.

The following code example shows an app creating a hypothesis, updating it, and then finalizing it.

```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."); 
} 
```

The following code example shows an app creating a hypothesis, updating it, and then canceling it.

```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); 
} 
```

<a id="requirementsSection" />

## Requirements

**Header:** XAccessibility.h

**Library:** xgameruntime.lib

**Supported platforms:** Windows, XBOX One family consoles and XBOX Series consoles

<a id="seealsoSection" />

## See also

[XAccessibility](/reference/system/xaccessibility/xaccessibility_members)


## Related topics

- [XSpeechToTextCancelHypothesisString](/reference/system/xaccessibility/functions/xspeechtotextcancelhypothesisstring.md)
- [XSpeechToTextUpdateHypothesisString](/reference/system/xaccessibility/functions/xspeechtotextupdatehypothesisstring.md)
- [XSpeechToTextFinalizeHypothesisString](/reference/system/xaccessibility/functions/xspeechtotextfinalizehypothesisstring.md)
- [XAccessibility](/reference/system/xaccessibility/xaccessibility_members.md)
- [Unity C# API wrappers for the GDK](/build/gdk-and-engines/unity/unity-api-wrappers.md)
