simulstream.server.speech_processors.incremental_output.IncrementalOutput

class simulstream.server.speech_processors.incremental_output.IncrementalOutput(new_tokens: List[str], new_string: str, deleted_tokens: List[str], deleted_string: str)

Bases: object

Represents the incremental output of a speech processor for a single processed chunk of audio.

new_tokens

List of newly generated tokens in this chunk.

Type:

List[str]

new_string

Concatenated string representation of the new tokens.

Type:

str

deleted_tokens

List of tokens that were deleted/overwritten.

Type:

List[str]

deleted_string

Concatenated string representation of the deleted tokens.

Type:

str

__init__(new_tokens: List[str], new_string: str, deleted_tokens: List[str], deleted_string: str) None

Methods

__init__(new_tokens, new_string, ...)

strings_to_json()

Serialize the incremental output to a JSON string.

Attributes

new_tokens

new_string

deleted_tokens

deleted_string

strings_to_json() str

Serialize the incremental output to a JSON string.

Returns:

A JSON string containing the newly generated and the deleted text.

Return type:

str