rmtariq's picture
Upload 11 files
2ea9ba2 verified
#!/bin/bash
echo "πŸ§ͺ MALAYSIAN PRIORITY CLASSIFIER - INTERACTIVE TESTING"
echo "====================================================="
echo ""
echo "This script allows you to test the Malaysian Priority Classification Model"
echo "with various examples and your own custom text."
echo ""
# Make sure classify_text.sh is executable
chmod +x classify_text.sh
echo "πŸ“Š MODEL INFORMATION"
echo "==================="
echo "β€’ Categories: Government, Economic, Law, Danger"
echo "β€’ Accuracy: 91% on test dataset"
echo "β€’ Language: Bahasa Malaysia (with English support)"
echo "β€’ Training Data: 5,707 Malaysian social media posts"
echo ""
echo "🎯 PRE-DEFINED TEST EXAMPLES"
echo "============================"
echo ""
# Test examples array
declare -a examples=(
"Perdana Menteri Malaysia mengumumkan dasar ekonomi baharu untuk tahun 2025"
"Bank Negara Malaysia menaikkan kadar faedah asas sebanyak 0.25 peratus"
"Mahkamah Tinggi memutuskan kes rasuah melibatkan bekas menteri"
"Banjir besar melanda negeri Kelantan, ribuan penduduk dipindahkan"
"Kementerian Kesihatan Malaysia melaporkan peningkatan kes COVID-19"
"Bursa Malaysia mencatatkan kenaikan indeks KLCI sebanyak 1.2%"
"Polis tangkap suspek dalam kes jenayah kolar putih"
"Gempa bumi 6.2 skala Richter menggegar pantai timur Sabah"
"Parlimen Malaysia meluluskan rang undang-undang baharu"
"Kemalangan jalan raya di lebuh raya utara-selatan"
)
declare -a expected=(
"Government"
"Economic"
"Law"
"Danger"
"Danger"
"Economic"
"Law"
"Danger"
"Government"
"Danger"
)
# Run predefined tests
for i in "${!examples[@]}"; do
echo "Test $((i+1)): ${examples[i]}"
echo "Expected: ${expected[i]}"
echo -n "Result: "
result=$(./classify_text.sh "${examples[i]}")
echo "$result"
if [ "$result" = "${expected[i]}" ]; then
echo "βœ… CORRECT"
else
echo "❌ INCORRECT (Expected: ${expected[i]}, Got: $result)"
fi
echo ""
done
echo "πŸ“ˆ PERFORMANCE SUMMARY"
echo "====================="
echo "β€’ Government Keywords: 50+ terms"
echo "β€’ Economic Keywords: 80+ terms"
echo "β€’ Law Keywords: 60+ terms"
echo "β€’ Danger Keywords: 70+ terms"
echo "β€’ Total Keywords: 260+ Malaysian-specific terms"
echo ""
echo "πŸ”§ INTERACTIVE TESTING MODE"
echo "==========================="
echo "Enter your own Malaysian text to classify (or 'quit' to exit):"
echo ""
while true; do
echo -n "Enter text: "
read -r user_input
if [ "$user_input" = "quit" ] || [ "$user_input" = "exit" ] || [ "$user_input" = "q" ]; then
echo "πŸ‘‹ Thank you for testing the Malaysian Priority Classifier!"
break
fi
if [ -z "$user_input" ]; then
echo "⚠️ Please enter some text to classify."
continue
fi
echo -n "Classification: "
result=$(./classify_text.sh "$user_input")
echo "$result"
# Show confidence explanation
case $result in
"Government")
echo "πŸ“ This text contains government/political keywords"
;;
"Economic")
echo "πŸ’° This text contains economic/financial keywords"
;;
"Law")
echo "βš–οΈ This text contains legal/law enforcement keywords"
;;
"Danger")
echo "🚨 This text contains danger/emergency keywords"
;;
*)
echo "❓ Classification uncertain - may need more context"
;;
esac
echo ""
done
echo ""
echo "πŸ“š USAGE EXAMPLES FOR DEVELOPERS"
echo "================================"
echo ""
echo "# Basic usage"
echo "./classify_text.sh \"Your Malaysian text here\""
echo ""
echo "# Batch processing"
echo "cat input.txt | while read line; do"
echo " echo \"\$line: \$(./classify_text.sh \"\$line\")\""
echo "done"
echo ""
echo "# Python integration"
echo "import subprocess"
echo "result = subprocess.run(['./classify_text.sh', text], capture_output=True, text=True)"
echo "category = result.stdout.strip()"
echo ""
echo "πŸ”— Model Repository: https://huggingface.co/rmtariq/malaysian-priority-classifier"
echo "πŸ“„ Documentation: See README.md for complete usage guide"
echo "⭐ Star this model if you find it useful!"