gruut-lang-en

raw JSON →
2.0.1 verified Mon Apr 27 auth: no python

English language data files for the gruut tokenizer/phonemizer. This package provides English-specific lexicons, pronunciations, and grammar rules. It is a companion to the core gruut library. As of version 2.0.1, it contains data extracted from the main gruut package to allow independent updates. The library follows the release cadence of gruut and is maintained under the Rhasspy project.

pip install gruut-lang-en
error No language data found for 'en-us'
cause The gruut-lang-en package is not installed, so gruut cannot find English data.
fix
Run 'pip install gruut-lang-en' to install the English language data.
error ModuleNotFoundError: No module named 'gruut'
cause The core gruut library is not installed.
fix
Run 'pip install gruut'.
breaking In gruut v2.0.0, the API changed significantly: the 'gruut.sentences' function replaces the old 'gruut.tokenize' and 'gruut.phonemize' commands. With --ssml, stdin input is treated as a single SSML document by default; use --stdin-format lines to restore per-line behavior.
fix Update code to use 'from gruut import sentences' and call 'sentences(text, lang="en-us")'. For SSML, pass lang=None or adjust stdin format.
gotcha The English data package is separate: installing gruut alone does not include any language data. You must also install at least one language package (e.g., gruut-lang-en) to process text.
fix Always run 'pip install gruut[en]' or 'pip install gruut-lang-en' alongside gruut.
deprecated Inline pronunciations and <number>_<format> tokens were removed in gruut v2.0.0. Use SSML <say-as> or <sub> tags instead.
fix Replace inline pronunciations with SSML elements.

Tokenize and phonemize English text. Ensure gruut-lang-en is installed for English support. The 'lang' parameter must match an installed language package.

import os
from gruut import sentences

text = "Hello, world!"
for sentence in sentences(text, lang="en-us"):
    for word in sentence:
        print(word.text, word.phonemes)