File size: 1,141 Bytes
248c176 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
#!/bin/bash
# Set the source directory containing the JSON files
source_dir="multilingual"
# Set the destination directory to save the modified JSON files
destination_dir="fi_processed"
# Create the destination directory if it doesn't exist
mkdir -p "$destination_dir"
# Process each train split JSON file in the source directory
for file in "$source_dir"/c4-fi.*.json; do
# Extract the filename without the directory path and extension
filename=$(basename -- "$file")
filename="${filename%.*}"
# Remove the "lang" key from the JSON file using jq because it had errors while trying to load into huggingface datasets
jq -c 'del(.lang)' "$file" > "$destination_dir/$filename.json"
done
# Process each validation split JSON file in the source directory
for file in "$source_dir"/c4-fi-validation*.json; do
# Extract the filename without the directory path and extension
filename=$(basename -- "$file")
filename="${filename%.*}"
# Remove the "lang" key from the JSON file using jq because it had errors while trying to load into huggingface datasets
jq -c 'del(.lang)' "$file" > "$destination_dir/$filename.json"
done
|