<s> '''<STR_LIT>''' <EOL> FRAG_FILE = '<STR_LIT>' <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> import argparse <EOL> parser = argparse . ArgumentParser ( ) <EOL> parser . add_argument ( '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' ) <EOL> args = parser . parse_args ( ) <EOL> frag_utts = set ( ) <EOL> with open ( FRAG_FILE , '<STR_LIT:r>' ) as fin : <EOL> lines = fin . read ( ) . strip ( ) . splitlines ( ) <EOL> for l in lines : <EOL> utt_key , frag_word = l . split ( '<STR_LIT:U+0020>' , <NUM_LIT:1> ) <EOL> frag_utts . add ( utt_key ) <EOL> with open ( args . hyp , '<STR_LIT:r>' ) as fin : <EOL> lines = fin . read ( ) . splitlines ( ) <EOL> frag_utt_count = <NUM_LIT:0> <EOL> tot_utt_count = <NUM_LIT:0> <EOL> fout = open ( args . hyp_out , '<STR_LIT:w>' ) <EOL> for l in lines : <EOL> parts = l . split ( '<STR_LIT:U+0020>' , <NUM_LIT:1> ) <EOL> if len ( parts ) == <NUM_LIT:1> : <EOL> assert False <EOL> utt_key , utt = parts <EOL> if utt_key not in frag_utts : <EOL> tot_utt_count += <NUM_LIT:1> <EOL> continue <EOL> fout . write ( l + '<STR_LIT:\n>' ) <EOL> tot_utt_count += <NUM_LIT:1> <EOL> frag_utt_count += <NUM_LIT:1> <EOL> fout . close ( ) <EOL> print '<STR_LIT>' % ( frag_utt_count , tot_utt_count ) <EOL> stm_frag_utts = <NUM_LIT:0> <EOL> frag_utt_starts = set ( ) <EOL> for ou in frag_utts : <EOL> ou_start = '<STR_LIT:->' . join ( ou . split ( '<STR_LIT:->' ) [ <NUM_LIT:0> : <NUM_LIT:2> ] ) <EOL> frag_utt_starts . add ( ou_start ) <EOL> with open ( args . stm , '<STR_LIT:r>' ) as fin : <EOL> lines = fin . read ( ) . strip ( ) . splitlines ( ) <EOL> fout = open ( args . stm_out , '<STR_LIT:w>' ) <EOL> for l in lines : <EOL> if l . startswith ( '<STR_LIT>' ) : <EOL> fout . write ( l + '<STR_LIT:\n>' ) <EOL> continue <EOL> parts = l . split ( '<STR_LIT:U+0020>' , <NUM_LIT:6> ) <EOL> utt_key_part , channel , utt_key , t_start , t_end , metadata , utt = parts <EOL> stm_utt_key = '<STR_LIT>' % ( utt_key_part , channel . lower ( ) , int ( float ( t_start ) * <NUM_LIT:100> ) ) <EOL> print stm_utt_key <EOL> if stm_utt_key not in frag_utt_starts : <EOL> continue <EOL> fout . write ( l + '<STR_LIT:\n>' ) <EOL> stm_frag_utts += <NUM_LIT:1> <EOL> fout . close ( ) <EOL> print '<STR_LIT>' % ( stm_frag_utts , tot_utt_count ) </s>
