#!/bin/bash folderPath=$1 fileName=$2 major=$3 split_size=$4 echo "正在进行文件预处理,请稍后" python3 step1_pre.py "$folderPath/$fileName" "$major" "$split_size" echo "文件预处理完成,请查看spilited_ai1文件夹中内容" echo "现在开始处理AI答案正确检测...第一遍" i=0 for file in $(ls "$folderPath"/spilited_ai1 | sort -V) do echo "启动任务,文件路径是:$folderPath/spilited_ai1/$file" nohup python3 step2_ai1.py "$folderPath" "$folderPath/spilited_ai1/$file" "$i" > /dev/null 2>&1 & i=$((i+1)) done # 检测AI1任务是否完成 while true; do file_count=$(ls -1 "$folderPath/ai_1" | grep -v '^d' | wc -l) echo "AI1当前文件数量为" echo "$file_count" if [ "$file_count" -ge "$i" ]; then echo "AI1任务全部完成,继续执行后续操作..." break else echo "未达到" echo "$i" echo "个,等待10秒后继续..." sleep 10 fi done echo "现在开始处理AI答案正确检测...第二遍" j=0 for file in $(ls "$folderPath"/ai_1 | sort -V) do echo "启动任务,文件路径是:$folderPath/ai_1/$file" nohup python3 step3_ai2.py "$folderPath" "$folderPath/ai_1/$file" "$j" > /dev/null 2>&1 & j=$((j+1)) done # 检测AI2任务是否完成 while true; do file_count=$(ls -1 "$folderPath/ai_2" | grep -v '^d' | wc -l) echo "AI2当前文件数量为" echo "$file_count" if [ "$file_count" -ge "$i" ]; then echo "AI2任务全部完成,继续执行后续操作..." break else echo "未达到" echo "$i" echo "个,等待10秒后继续..." sleep 10 fi done echo "现在开始合并最终结果" cat "$folderPath"/ai_2/* > "$folderPath"/ai_2_total/final_output.jsonl echo "处理完成,请注意合并数据时课程与后续id重设等操作!"