Download scripts/preprocess_data.py from EzioDevio/iraqi_dialect_llm: direct link, hf CLI and curl.
- Browser
- Download file 610 Bytes
-
https://huggingface.co/EzioDevio/iraqi_dialect_llm/resolve/main/scripts/preprocess_data.py
- Command line
-
hf download hf://EzioDevio/iraqi_dialect_llm/scripts/preprocess_data.py
-
curl -L -o preprocess_data.py https://huggingface.co/EzioDevio/iraqi_dialect_llm/resolve/main/scripts/preprocess_data.py
610 Bytes
| import pandas as pd | |
| def preprocess_data(input_file, output_file): | |
| data = [] | |
| with open(input_file, "r", encoding="utf-8") as f: | |
| for line in f: | |
| if " - " in line: | |
| proverb, meaning = line.split(" - ", 1) | |
| data.append({"proverb": proverb.strip(), "meaning": meaning.strip()}) | |
| # Save as a DataFrame | |
| df = pd.DataFrame(data) | |
| df.to_csv(output_file, index=False) | |
| print(f"Data saved to {output_file}") | |
| # Example usage | |
| input_file = "data/raw_data/iraqi_data.txt" | |
| output_file = "data/processed_data.csv" | |
| preprocess_data(input_file, output_file) | |