speechmarkdown.formatters.text#

Classes#

TextFormatter

Formatter for outputting plain text instead of SSML elements.

Module Contents#

class speechmarkdown.formatters.text.TextFormatter(options: speechmarkdown.options.SpeechOptions)[source]#

Bases: speechmarkdown.formatters.base.FormatterBase

Formatter for outputting plain text instead of SSML elements.

format(ast: speechmarkdown.parser.ASTNode | List[speechmarkdown.parser.ASTNode]) str[source]#

Format the AST to basic plain text strings without SSML tags.

Parameters:

ast (Union[ASTNode, List[ASTNode]]) – The root node(s) to convert.

Returns:

Output formatted as plain text.

Return type:

str

formatFromAst(ast: speechmarkdown.parser.ASTNode, lines: List[str] | None = None) List[str][source]#

Process single nodes handling text appending correctly.

Parameters:
  • ast (ASTNode) – Focus AST element to render text.

  • lines (Optional[List[str]]) – The collector line list.

Returns:

Refreshed output chunks.

Return type:

List[str]

extractParenthesizedText(node: speechmarkdown.parser.ASTNode) str[source]#