Skip to content

Commit

Permalink
lowered the output directory name
Browse files Browse the repository at this point in the history
  • Loading branch information
SethiShreya committed Nov 1, 2024
1 parent 89f4036 commit 02df986
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/scribe_data/cli/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def get_data(
):
print(f"Updated data was saved in: {Path(output_dir).resolve()}.")

json_input_path = Path(output_dir) / f"{language.capitalize()}/{data_type}.json"
json_input_path = Path(output_dir) / f"{language}/{data_type}.json"

# Proceed with conversion only if the output type is not JSON.
if output_type != "json":
Expand Down
6 changes: 3 additions & 3 deletions src/scribe_data/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def load_queried_data(
tuple(Any, str)
A tuple containing the loaded data and the path to the data file.
"""
data_path = Path(file_path) / language / f"{data_type}.json"
data_path = Path(file_path) / language.lower() / f"{data_type}.json"

with open(data_path, encoding="utf-8") as f:
return json.load(f), data_path
Expand Down Expand Up @@ -314,15 +314,15 @@ def export_formatted_data(
None
"""
export_path = (
Path(file_path) / language.capitalize() / f"{data_type.replace('-', '_')}.json"
Path(file_path) / language.lower() / f"{data_type.replace('-', '_')}.json"
)

with open(export_path, "w", encoding="utf-8") as file:
json.dump(formatted_data, file, ensure_ascii=False, indent=0)
file.write("\n")

print(
f"Wrote file {language.capitalize()}/{data_type.replace('-', '_')}.json with {len(formatted_data):,} {data_type}."
f"Wrote file {language.lower()}/{data_type.replace('-', '_')}.json with {len(formatted_data):,} {data_type}."
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@

from scribe_data.utils import export_formatted_data, load_queried_data

LANGUAGE = "English"
LANGUAGE = "english"
DATA_TYPE = "verbs"


parser = argparse.ArgumentParser()
parser.add_argument("--file-path")
args = parser.parse_args()
Expand Down
2 changes: 1 addition & 1 deletion src/scribe_data/wikidata/query_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def query_data(
target_type = q.parent.name

updated_path = output_dir[2:] if output_dir.startswith("./") else output_dir
export_dir = Path(updated_path) / lang.capitalize()
export_dir = Path(updated_path) / lang
export_dir.mkdir(parents=True, exist_ok=True)

file_name = f"{target_type}.json"
Expand Down

0 comments on commit 02df986

Please sign in to comment.