gruut-lang-fr

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

French language data files for the gruut tokenizer/phonemizer library. Provides grapheme-to-phoneme (g2p) models, lexicons, and language-specific rules for French text normalization and pronunciation. Current version: 2.0.2, released as part of gruut v2.0.0 refactoring. Gruut core releases frequently; language packages versioned independently.

pip install gruut-lang-fr
error ModuleNotFoundError: No module named 'gruut_lang_fr'
cause Language package not installed.
fix
pip install gruut-lang-fr
error AttributeError: module 'gruut' has no attribute 'tokenize'
cause Using gruut v2 API with v1 code.
fix
Use gruut.sentences() instead. See gruut v2 migration guide.
error RuntimeError: No language data for 'fr'
cause gruut-lang-fr not installed or version mismatch.
fix
Ensure gruut-lang-fr is installed and compatible with the installed gruut core version.
breaking Gruut v2.0.0 changed the API from gruut.tokenize to gruut.sentences. Old code using gruut.tokenize will break.
fix Use gruut.sentences() instead of gruut.tokenize(). See quickstart example.
breaking The language data packages (gruut-lang-*) are separate from the core gruut package. Simply installing gruut does not include language data.
fix Install the specific language package: pip install gruut-lang-fr
gotcha Language data is automatically loaded when using lang='fr'. Manually importing gruut_lang_fr is not supported and may cause issues.
fix Do not import gruut_lang_fr. Simply set lang='fr' in gruut functions.

Simple example using gruut with French language data.

import gruut

# Tokenize and phonemize French text
sentences = gruut.sentences('Bonjour le monde', lang='fr')
for sentence in sentences:
    for word in sentence:
        if word.phonemes:
            print(f"{word.text} -> {''.join(word.phonemes)}")