Registry / ai-ml / gruut
library2.4.0pypypi✓ verified 85d ago

A tokenizer, text cleaner, and phonemizer for many human languages. Current version: 2.4.0. Release cadence: irregular, with major version bumps introducing API and CLI changes.

pip install gruut
INSTALL
IMPORT
SIG · GRUUT
G
gruut
ai-mlpythonv2.4.0
Install
12.5s avg
Import
1984ms
Disk
196MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.4.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 2.038s · 195.2MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 12.5s · import 1.930s · 189MB
196MB installed
● package 196MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

gruut
import gruut
Top-level import; use gruut.sentences() for processing.
Phonemizer
from gruut import phonemizer
from gruut.phonemizer import Phonemizer
The phonemizer function is in the top-level gruut module.

Tokenize and phonemize a sentence with gruut.

import gruut text = "Hello world." # Use a language code (e.g., 'en-us') for sentence in gruut.sentences(text, lang='en-us'): for word in sentence: if word.phonemes: print(f"{word.text}: {' '.join(word.phonemes)}")
gruut --version
Debug
Known issues
breakingAPI change in v2.0.0: The old inline pronunciation and <number>_<format> syntax were removed. Use SSML instead.
fix
Migrate to SSML tags like <say-as interpret-as='date'> for date/time expansion.
affects: <2.0.0
breakingCLI change in v2.0.0: Use 'gruut.sentences' subcommand instead of 'gruut' directly.
fix
Run 'gruut sentences' instead of 'gruut'.
affects: <2.0.0
breakingEnglish language data moved to a separate package in v2.1.0. Must install gruut-lang-en explicitly.
fix
Run 'pip install gruut-lang-en' or install gruut with the langs extra: 'pip install gruut[langs]'.
affects: >=2.1.0
deprecatedPython 3.6 support is no longer guaranteed; latest releases require Python >=3.6 but newer dependencies may drop it.
fix
Use Python 3.7 or newer.
affects: >=2.4.0
gotchaThe 'gruut' package does not include any language data by default. You must install language-specific packages.
fix
Install gruut-lang-<lang> for your language (e.g., gruut-lang-en).
affects: >=2.1.0
gotchaWhen using stdin with --ssml in CLI v2.1.0+, input is assumed to be one SSML document per line unless --stdin-format lines is set.
fix
Use --stdin-format lines for line-by-line input.
affects: >=2.1.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'gruut.lang'
Missing language data package for the requested language.
fix
Install the corresponding gruut-lang-<lang> package, e.g., pip install gruut-lang-en.
AttributeError: module 'gruut' has no attribute 'text_to_phonemes'
Using old API from gruut v1.x.
fix
Use gruut.sentences() instead. See quickstart.
ValueError: Unknown language: en
Language code not recognized because data not installed.
fix
Install the language data package for 'en' (e.g., gruut-lang-en).
Upgrade
Version history
2.4.0latest on PyPI · released Jul 3, 2024
Audit
Dependencies
gruut-lang-enoptionalEnglish language data is now a separate package (since v2.1.0).
Agent activity
11 hits · last 30 days
node
10
OpenAI (training)
1
Resources