<s> import sys , string <EOL> word_freqs = [ ] <EOL> with open ( '<STR_LIT>' ) as f : <EOL> stop_words = f . read ( ) . split ( '<STR_LIT:U+002C>' ) <EOL> stop_words . extend ( list ( string . ascii_lowercase ) ) <EOL> for line in open ( sys . argv [ <NUM_LIT:1> ] ) : <EOL> start_char = None <EOL> i = <NUM_LIT:0> <EOL> for c in line : <EOL> if start_char == None : <EOL> if c . isalnum ( ) : <EOL> start_char = i <EOL> else : <EOL> if not c . isalnum ( ) : <EOL> found = False <EOL> word = line [ start_char : i ] . lower ( ) <EOL> if word not in stop_words : <EOL> pair_index = <NUM_LIT:0> <EOL> for pair in word_freqs : <EOL> if word == pair [ <NUM_LIT:0> ] : <EOL> pair [ <NUM_LIT:1> ] += <NUM_LIT:1> <EOL> found = True <EOL> found_at = pair_index <EOL> break <EOL> pair_index += <NUM_LIT:1> <EOL> if not found : <EOL> word_freqs . append ( [ word , <NUM_LIT:1> ] ) <EOL> elif len ( word_freqs ) > <NUM_LIT:1> : <EOL> for n in reversed ( range ( pair_index ) ) : <EOL> if word_freqs [ pair_index ] [ <NUM_LIT:1> ] > word_freqs [ n ] [ <NUM_LIT:1> ] : <EOL> word_freqs [ n ] , word_freqs [ pair_index ] = word_freqs [ pair_index ] , word_freqs [ n ] <EOL> pair_index = n <EOL> start_char = None <EOL> i += <NUM_LIT:1> <EOL> for tf in word_freqs [ <NUM_LIT:0> : <NUM_LIT> ] : <EOL> print tf [ <NUM_LIT:0> ] , '<STR_LIT>' , tf [ <NUM_LIT:1> ] </s>
