Download scripts/preprocess.py from EzioDevio/iraqi_dialect_llm: direct link, hf CLI and curl.
- Browser
- Download file 516 Bytes
-
https://huggingface.co/EzioDevio/iraqi_dialect_llm/resolve/main/scripts/preprocess.py
- Command line
-
hf download hf://EzioDevio/iraqi_dialect_llm/scripts/preprocess.py
-
curl -L -o preprocess.py https://huggingface.co/EzioDevio/iraqi_dialect_llm/resolve/main/scripts/preprocess.py
516 Bytes
| # scripts/preprocess.py | |
| import re | |
| def clean_text(text): | |
| text = re.sub(r'[^\u0621-\u064A\s]', '', text) # Arabic letters only | |
| text = re.sub(r'\s+', ' ', text).strip() | |
| return text | |
| if __name__ == "__main__": | |
| with open('../data/raw_data/iraqi_data.txt', 'r') as f: | |
| raw_data = f.readlines() | |
| cleaned_data = [clean_text(line) for line in raw_data] | |
| with open('../data/cleaned_data/iraqi_data_cleaned.txt', 'w') as f: | |
| for line in cleaned_data: | |
| f.write(line + '\n') | |