Ejemplo n.º 1
0
 def word_data(self):
     '''Word counts and neighbors for all tweets.'''
     all_text = ""
     for user in self._population:
         tweets = user['tweets']
         for tweet in tweets:
             all_text += tweet['text']
     counter = WordCounter(all_text)
     word_data = counter.get_word_data()
     return word_data
Ejemplo n.º 2
0
 def word_data(self):
     '''Word counts and neighbors for all tweets.'''
     all_text = ""
     for user in self._population:
         tweets = user['tweets']
         for tweet in tweets:
             all_text += tweet['text']
     counter = WordCounter(all_text)
     word_data = counter.get_word_data()
     return word_data
Ejemplo n.º 3
0
 def all_word_data(self):
     '''Returns word counts and neighbors for all of a user's tweets.'''
     for member in self._population:
         if member['uid'] == self._uid:
             found = True
             break
         else:
             found = False
     if not found:
         raise Exception('User not in population: %s' % self._uid)
     all_text = ""
     for tweet in user['tweets']:
         all_text += ' ' + tweet['text']
     counter = WordCounter(all_text)
     word_data = counter.get_word_data()
     return word_data
Ejemplo n.º 4
0
 def all_word_data(self):
     '''Returns word counts and neighbors for all of a user's tweets.'''
     for member in self._population:
         if member['uid'] == self._uid:
             found = True
             break
         else:
             found = False
     if not found:
         raise Exception('User not in population: %s' % self._uid)
     all_text = ""
     for tweet in user['tweets']:
         all_text += ' ' + tweet['text']
     counter = WordCounter(all_text)
     word_data = counter.get_word_data()
     return word_data
Ejemplo n.º 5
0
 def individual_word_data(self):
     '''Word counts and neighbors for each of a user's tweets.'''
     for member in self._population:
         if member['uid'] == self._uid:
             found = True
             break
         else:
             found = False
     if not found:
         raise Exception('User not in population: %s' % self._uid)
     tweet_data = []
     for tweet in user['tweets']:
         text = tweet['text']
         counter = WordCounter(text)
         word_data = counter.get_word_data()
         tweet_data.append({'id':tweet['id'], 'text':text, \
           'word_data':word_data})
     return tweet_data
Ejemplo n.º 6
0
 def words_by_day(self):
     word_counts = {}
     for day, tweets in self._tweets_by_day.items():
         tweet_text = ''
         for tweet in tweets:
             tweet_text += tweet['text']
         day_counts = WordCounter(tweet_text).get_word_data()
         word_counts[day] = day_counts
     return word_counts
Ejemplo n.º 7
0
 def individual_word_data(self):
     '''Word counts and neighbors for each of a user's tweets.'''
     for member in self._population:
         if member['uid'] == self._uid:
             found = True
             break
         else:
             found = False
     if not found:
         raise Exception('User not in population: %s' % self._uid)
     tweet_data = []
     for tweet in user['tweets']:
         text = tweet['text']
         counter = WordCounter(text)
         word_data = counter.get_word_data()
         tweet_data.append({'id':tweet['id'], 'text':text, \
           'word_data':word_data})
     return tweet_data