code: def read_csv(directory):
      '''
      Scrape a twitter archive csv, yielding tweet text.
  
      Args:
          directory (str): CSV file or (directory containing tweets.csv).
          field (str): Field with the tweet's text (default: text).
          fieldnames (list): The column names for a csv with no header. Must contain <field>.
                              Leave as None to read CSV header (default: None).
  
      Returns:
          generator
      '''
      if path.isdir(directory):
          csvfile = path.join(directory, 'tweets.csv')
      else:
          csvfile = directory
  
      with open(csvfile, 'r') as f:
          for tweet in csv.DictReader(f):
              try:
                  tweet['text'] = tweet['text'].decode('utf-8')
              except AttributeError:
                  pass
  
              yield tweef read_csv(directory):
      '''
      Scrape a twitter archive csv, yielding tweet text.
  
      Args:
          directory (str): CSV file or (directory containing tweets.csv).
          field (str): Field with the tweet's text (default: text).
          fieldnames (list): The column names for a csv with no header. Must contain <field>.
                              Leave as None to read CSV header (default: None).
  
      Returns:
          generator
      '''
      if path.isdir(directory):
          csvfile = path.join(directory, 'tweets.csv')
      else:
          csvfile = directory
  
      with open(csvfile, 'r') as f:
          for tweet in csv.DictReader(f):
              try:
                  tweet['text'] = tweet['text'].decode('utf-8')
              except AttributeError:
                  pass
  
              yield tweet
docs: Scrape a twitter archive csv, yielding tweet text.
  
      Args:
          directory (str): CSV file or (directory containing tweets.csv).
          field (str): Field with the tweet's text (default: text).
          fieldnames (list): The column names for a csv with no header. Must contain <field>.
                              Leave as None to read CSV header (default: None).
  
      Returns:
          generator