#!/bin/sh

#  Step #1 in the scoring of Speaker Recognition Evaluations.
#
#          This script will separate a "SINGLE" submission file.
#          The file should be named the "BASE" name of the system,
#	   and to make life easy...it should be the same names as
#          the directory it is in.
#
#
#  MAKE A GENERIC FILE
#
GENERIC=${1}_generic
cat $1 | tr A-Z a-z | sed 's:.wav::' | \
         awk '{print $1,$2,$3,$4,$5,$6,$7}' >${GENERIC}

#  1 SESSION MALES
#
# 1s males, 30 seconds
grep "m 1s" ${GENERIC} | grep " 30 " >${1}_30_m_1s
# 1s males, 10 seconds
grep "m 1s" ${GENERIC} | grep " 10 " >${1}_10_m_1s
# 1s males, 3 seconds
grep "m 1s" ${GENERIC} | grep " 3 " >${1}_3_m_1s

#  1 SESSION FEMALES
#
# 1s females, 30 seconds
grep "f 1s" ${GENERIC} | grep " 30 " >${1}_30_f_1s
# 1s females, 10 seconds
grep "f 1s" ${GENERIC} | grep " 10 " >${1}_10_f_1s
# 1s females, 3 seconds
grep "f 1s" ${GENERIC} | grep " 3 " >${1}_3_f_1s


#  1 HANDSET MALES
#
# 1h males, 30 seconds
grep "m 1h" ${GENERIC} | grep " 30 " >${1}_30_m_1h
# 1h males, 10 seconds
grep "m 1h" ${GENERIC} | grep " 10 " >${1}_10_m_1h
# 1h males, 3 seconds
grep "m 1h" ${GENERIC} | grep " 3 " >${1}_3_m_1h

#  1 HANDSET FEMALES
#
# 1h females, 30 seconds
grep "f 1h" ${GENERIC} | grep " 30 " >${1}_30_f_1h
# 1h females, 10 seconds
grep "f 1h" ${GENERIC} | grep " 10 " >${1}_10_f_1h
# 1h females, 3 seconds
grep "f 1h" ${GENERIC} | grep " 3 " >${1}_3_f_1h


#  2 HANDSET MALES
#
# 2h males, 30 seconds
grep "m 2h" ${GENERIC} | grep " 30 " >${1}_30_m_2h
# 2h males, 10 seconds
grep "m 2h" ${GENERIC} | grep " 10 " >${1}_10_m_2h
# 2h males, 3 seconds
grep "m 2h" ${GENERIC} | grep " 3 " >${1}_3_m_2h

#  2 HANDSET FEMALES
#
# 2h females, 30 seconds
grep "f 2h" ${GENERIC} | grep " 30 " >${1}_30_f_2h
# 2h females, 10 seconds
grep "f 2h" ${GENERIC} | grep " 10 " >${1}_10_f_2h
# 2h females, 3 seconds
grep "f 2h" ${GENERIC} | grep " 3 " >${1}_3_f_2h


##
## Remove the GENERIC File
rm ${GENERIC}

# ------------------------------------------------------------
