#!/bin/bash
# Reproduce TMPC WMT zh->en results (Table 2 in the paper).
# Requires $LASER to be set (see README for LASER setup).
set -e

if [ -z "$LASER" ]; then
    echo "Error: LASER environment variable is not set."
    echo "Please run: export LASER=/path/to/LASER"
    exit 1
fi

OUTPUT_DIR="results/wmt_zh_en"
mkdir -p "$OUTPUT_DIR"

echo "=============================="
echo " WMT zh->en: TMPC Generation"
echo "=============================="
python run_wmt.py \
    --input_file wmt_zh_en.csv \
    --rm rl-bandits-lab/translation_rm \
    --src_language Chinese \
    --task_language English \
    --threshold 1.0 \
    --max_iterations 5 \
    --good_ref_contexts_num 5 \
    --cuda_num 0

echo "=============================="
echo " WMT zh->en: Merge Iterations"
echo "=============================="
python memory2csv.py \
    --num 4 \
    --input_csv wmt_zh_en.csv \
    --output_csv "$OUTPUT_DIR/eval_zh_en.csv" \
    --column_name TMPC

echo "=============================="
echo " WMT zh->en: SEGALE Evaluation"
echo "=============================="
python segale_ctx.py \
    --file "$OUTPUT_DIR/eval_zh_en.csv" \
    --target_column TMPC \
    --save "$OUTPUT_DIR/eval_scores" \
    --src_language Chinese \
    --task_language English \
    --gpu_id 0

echo "WMT zh->en experiment complete. Results saved to $OUTPUT_DIR/"
