def read_words(filename='nietzsche.txt', replace=['\n', '<eos>']):
 with tf.gfile.GFile(filename, 'r') as f:
  try:
   context_list = f.read().replace(*replace).split()
  except:
   f.seek(0)
   replace = [x.encode('utf-8') for x in replace]
   context_list = f.read().replace(*replace).split()
  return context_list

def read_words ( filename = 'nietzsche.txt' , replace = [ '\n' , '<eos>' ] ) : with tf . gfile . GFile ( filename , 'r' ) as f : try : context_list = f . read ( ) . replace ( * replace ) . split ( ) except : f . seek ( 0 ) replace = [ x . encode ( 'utf-8' ) for x in replace ] context_list = f . read ( ) . replace ( * replace ) . split ( ) return context_list
file to list format context .