def load_tweets(filename):
 try:
  archive = open(filename, 'r')
 except IOError:
  return {}
 tweets = {}
 for line in archive.readlines():
  try:
   (tid, text) = line.strip().split(' ', 1)
   tweets[int(tid)] = text.decode('utf-8')
  except Exception as e:
   err(('loading tweet %s failed due to %s' % (line, unicode(e))))
 archive.close()
 return tweets

def load_tweets ( filename ) : try : archive = open ( filename , 'r' ) except IOError : return { } tweets = { } for line in archive . readlines ( ) : try : ( tid , text ) = line . strip ( ) . split ( ' ' , 1 ) tweets [ int ( tid ) ] = text . decode ( 'utf-8' ) except Exception as e : err ( ( 'loading tweet %s failed due to %s' % ( line , unicode ( e ) ) ) ) archive . close ( ) return tweets
load tweets from file into dict .