Rhasspy/gruut : sqlite3.OperationalError: no such column: role

I forked rhasspy/gruut to include Luxembourgish as additional language. I followed the gruut documentation to create the SQLite database, the g2p model and the espeak word lexicon.

My luxembourgish lexicon has no word roles. I tried both scripts lexicon2db.py and corpus2db.py to create the lexicon.db files, with success. I checked the content of the database with the DB Browser for SQLite.

I modified the gruut/lang.py script by adding the following lines in positions 146 and 664 :

if lang_only == "lb-lb":
    # LĂ«tzebuergesch
    return get_lb_settings(lang_dir, **settings_args)
# -----------------------------------------------------------------------------
# Luxembourgish (lb, LĂ«tzebuergesch)
# -----------------------------------------------------------------------------    

def get_lb_settings(lang_dir=None, **settings_args) -> TextProcessorSettings:
    """Create settings for Luxembourgish"""
    settings_args = {
        "major_breaks": {".", "?", "!"},
        "minor_breaks": {",", ";", ":", "..."},
        "word_breaks": {"-", "_"},
        "begin_punctuations": {'"', "“", "«", "[", "(", "<", "„"},
        "end_punctuations": {'"', "”", "»", "]", ")", ">"},
        "default_currency": "EUR",
        "default_date_format": InterpretAsFormat.DATE_DMY,
        "replacements": [("’", "'")],  # normalize apostrophe
    return TextProcessorSettings(lang="lb_LB", **settings_args)    

Cloning and installing the modified repository in my Ubuntu 20.04 PC works as expected. But when running the command

gruut --language lb-lb "Hallo"

the following runtime error is issued :

sqlite3.OperationalError: no such column: role

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/mbarnig/GRUUT/bin/gruut", line 11, in <module>
    load_entry_point('gruut==2.0.4', 'console_scripts', 'gruut')()
  File "/home/mbarnig/GRUUT/lib/python3.8/site-packages/gruut/__main__.py", line 149, in main
    raise TextProcessingError(text) from e
gruut.__main__.TextProcessingError: Hallo

What is wrong with my fork ?
Thank you for your help.

Marco Barnig

Hi Marco! Your database schema looks fine to me. Is it possible gruut is somehow finding an old database? Try adding --debug to the command-line to have it print out exactly where its loading lexicon.db from.

Also, make sure you add an entry to LANG_ALIASES in gruut/const.py for Luxembourgish :slight_smile:

Thank you Mike for your help. I cleaned my development environment and added lb in the const.py file, without success.

The main problem was my wrong CLDR code for Luxembourg (lb_LB instead of lb_LU).
A few errors were still reported with the correct code lb_LU. Finally I opted for the same scheme as used by The Netherlands and by Portugal to return the TextProcessorSettings : lang="lb". Now gruut --language lb "Moien LĂ«tzebuerg" is working as expected.

I will finalize the changes made in my forked Github gruut repository and then open a pull request to merge Luxembourgish in your project.

1 Like

I just opened my pull request to add Luxembourgish in Rhasspy/gruut.

1 Like