Skip to content

Error regarding configs.spelling_correction.brillmoore_wikitypos_en #1697

@Water-Ty

Description

@Water-Ty

DeepPavlov version:
VERSION: 1.7.0
Python version:
PYTHON VERSION: 3.9
Operating system (ubuntu linux, windows, ...):
OPERATING SYSTEM: MAC OS
Issue:
When loading the model configs.spelling_correction.brillmoore_wikitypos_en, a KeyError appears.

Content or a name of a configuration file:
I believe the issue is in DeepPavLov/deeppavlov/vocabs/typos.py

Command that led to error:
RUNNING THE FILE (python main.py AND python3 main.py)

Error (including full traceback):

2024-12-25 16:14:36.275 ERROR in 'deeppavlov.core.common.params'['params'] at line 108: Exception in <class 'deeppavlov.vocabs.typos.Wiki100KDictionary'>
Traceback (most recent call last):
  File "_______.venv/lib/python3.9/site-packages/deeppavlov/core/common/params.py", line 102, in from_params
    component = obj(**dict(config_params, **kwargs))
  File ________.venv/lib/python3.9/site-packages/deeppavlov/vocabs/typos.py", line 146, in __init__
    super().__init__(data_dir, *args, **kwargs)
  File "_____________.venv/lib/python3.9/site-packages/deeppavlov/vocabs/typos.py", line 65, in __init__
    alphabet.remove('⟬')
KeyError: '⟬'
Traceback (most recent call last):
  File "________________/main.py", line 3, in <module>
    model = build_model(configs.spelling_correction.brillmoore_wikitypos_en,)
  File "____________.venv/lib/python3.9/site-packages/deeppavlov/core/commands/infer.py", line 55, in build_model
    component = from_params(component_config, mode=mode)
  File "______________.venv/lib/python3.9/site-packages/deeppavlov/core/common/params.py", line 96, in from_params
    config_params = {k: _init_param(v, mode) for k, v in config_params.items()}
  File "_________________ProjectHelix/.venv/lib/python3.9/site-packages/deeppavlov/core/common/params.py", line 96, in <dictcomp>
    config_params = {k: _init_param(v, mode) for k, v in config_params.items()}
  File "_________________u.venv/lib/python3.9/site-packages/deeppavlov/core/common/params.py", line 52, in _init_param
    param = from_params(param, mode=mode)
  File "/_____________/.venv/lib/python3.9/site-packages/deeppavlov/core/common/params.py", line 102, in from_params
    component = obj(**dict(config_params, **kwargs))
  File "______________/.venv/lib/python3.9/site-packages/deeppavlov/vocabs/typos.py", line 146, in __init__
    super().__init__(data_dir, *args, **kwargs)
  File "/________________________________lib/python3.9/site-packages/deeppavlov/vocabs/typos.py", line 65, in __init__
    alphabet.remove('⟬')
KeyError: '⟬'

When loading the model configs.spelling_correction.brillmoore_wikitypos_en, a KeyError occurs in the DeepPavlov library due to an attempt to remove a character '⟬' from the alphabet. This happens during the initialization of the Wiki100KDictionary component in the file deeppavlov/vocabs/typos.py. This can be easily solved with an if-else statement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions