diff --git a/src/scribe_data/cli/convert.py b/src/scribe_data/cli/convert.py index 569e6e2b..1ef07061 100644 --- a/src/scribe_data/cli/convert.py +++ b/src/scribe_data/cli/convert.py @@ -73,9 +73,7 @@ def convert_to_json( ------- None """ - normalized_language = language - - if not normalized_language: + if not language: raise ValueError(f"Language '{language.capitalize()}' is not recognized.") data_types = [data_type] if isinstance(data_type, str) else data_type @@ -83,7 +81,7 @@ def convert_to_json( if output_dir is None: output_dir = DEFAULT_JSON_EXPORT_DIR - json_output_dir = Path(output_dir) / normalized_language.capitalize() + json_output_dir = Path(output_dir) / language.capitalize() json_output_dir.mkdir(parents=True, exist_ok=True) for dtype in data_types: @@ -159,7 +157,7 @@ def convert_to_json( f"File '{output_file}' already exists. Overwrite? (y/n): " ) if user_input.lower() != "y": - print(f"Skipping {normalized_language['language']} - {dtype}") + print(f"Skipping {language['language']} - {dtype}") continue try: @@ -211,9 +209,7 @@ def convert_to_csv_or_tsv( ------- None """ - normalized_language = language - - if not normalized_language: + if not language: raise ValueError(f"Language '{language.capitalize()}' is not recognized.") if isinstance(data_type, str): diff --git a/src/scribe_data/cli/total.py b/src/scribe_data/cli/total.py index eeafdf15..e0619695 100644 --- a/src/scribe_data/cli/total.py +++ b/src/scribe_data/cli/total.py @@ -53,12 +53,11 @@ def get_qid_by_input(input_str): The QID corresponding to the input string, or- None if not found. """ if input_str: - input_str_lower = input_str - if input_str_lower in language_to_qid: - return language_to_qid[input_str_lower] + if input_str in language_to_qid: + return language_to_qid[input_str] - elif input_str_lower in data_type_metadata: - return data_type_metadata[input_str_lower] + elif input_str in data_type_metadata: + return data_type_metadata[input_str] return None diff --git a/src/scribe_data/utils.py b/src/scribe_data/utils.py index 08194a63..fbd3db2b 100644 --- a/src/scribe_data/utils.py +++ b/src/scribe_data/utils.py @@ -76,8 +76,6 @@ # Process each language and its potential sub-languages in one pass. for lang, lang_data in language_metadata.items(): - lang_lower = lang - if "sub_languages" in lang_data: for sub_lang, sub_lang_data in lang_data["sub_languages"].items(): sub_lang_lower = sub_lang @@ -98,8 +96,8 @@ print(f"Warning: 'qid' missing for language {lang.capitalize()}") else: - language_map[lang_lower] = lang_data - language_to_qid[lang_lower] = qid + language_map[lang] = lang_data + language_to_qid[lang] = qid def _load_json(package_path: str, file_name: str) -> Any: