def write_vocab_and_sums(vocab, sums, vocab_filename, sums_filename):
 with open(os.path.join(FLAGS.output_dir, vocab_filename), 'w') as vocab_out:
  with open(os.path.join(FLAGS.output_dir, sums_filename), 'w') as sums_out:
   for (tok, cnt) in itertools.izip(vocab, sums):
    print >>vocab_out, tok
    print >>sums_out, cnt

def write_vocab_and_sums ( vocab , sums , vocab_filename , sums_filename ) : with open ( os . path . join ( FLAGS . output_dir , vocab_filename ) , 'w' ) as vocab_out : with open ( os . path . join ( FLAGS . output_dir , sums_filename ) , 'w' ) as sums_out : for ( tok , cnt ) in itertools . izip ( vocab , sums ) : print >> vocab_out , tok print >> sums_out , cnt
writes vocabulary and marginal sum files .