indo_wiki / dedup_raw_wiki_data_indo.sh
sabilmakbar's picture
Init commit
15a95e7
raw
history blame
1.75 kB
#!/bin/bash
# all available lang codes in Indonesia local-languages or linguistically-related to Indonesian Language:
# "ace", "ban", "bjn", "bug", "gor", "id", "jv", "map-bms", "min", "ms", "nia", "su", "tet"
#params of executions
folder_dir_to_save=./wiki_indonesian_dedup
input_folder_to_be_dedup=./wiki_indonesian_raw
drop_hard_dupl=True
drop_soft_dupl=True
# main executions
# src: https://stackoverflow.com/a/18887210 (to list all files under a dir)
shopt -s nullglob
file_name_array=($input_folder_to_be_dedup/*)
shopt -u nullglob # Turn off nullglob to make sure it doesn't interfere with anything later
file_name_array="${file_name_array}"
if [ ${#file_name_array[@]} == 0 ]; then
echo "No files found under directory $input_folder_to_be_dedup" >&2
fi
if [ ! -d $folder_dir_to_save ];
then
echo "Dir $folder_dir_to_save not exists! Creating the dir..."
mkdir $folder_dir_to_save
fi
echo "The params hard-dedup drop is set as $drop_hard_dupl"
echo "The params soft-dedup drop is set as $drop_soft_dupl"
# echo "${file_name_array[0]}"
# echo "${file_name_array[1]}"
# echo "${file_name_array[2]}"
# echo "${file_name_array[3]}"
for val in ${!file_name_array[@]}; do
csv_path=${file_name_array[$val]}
if [[ ${csv_path} != *".csv" ]]; then
echo "The extracted file name isn't a CSV! Skipping! Received $csv_path"
continue
fi
echo "Executing Dedup on iteration no "$((val+1))" of total ${#file_name_array[@]} for input data $csv_path"
python cleanse_wiki_data.py \
--raw-csv-path $csv_path \
--drop-hard-dupl $drop_hard_dupl \
--drop-soft-dupl $drop_soft_dupl \
--save-dir-path $folder_dir_to_save
echo "Done Execution"
done
echo "Done Dedup Process"