-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanalyze_tweets.py
42 lines (19 loc) · 943 Bytes
/
analyze_tweets.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#analyze_tweets.py
import sqlite3
conn = sqlite3.connect('tweets.db')
print('***** MOST FREQUENTLY MENTIONED AUTHORS *****')
# Print the 5 most frequently mentioned authors in the entire corpus
print('*' * 20, '\n\n') # dividing line for readable output
print('***** TWEETS MENTIONING AADL *****')
# Print all tweets that mention the twitter user 'aadl' (the Ann Arbor District Library)
print('*' * 20, '\n\n')
print('***** MOST COMMON VERBS IN UMSI TWEETS *****')
# Print the 10 most common verbs ('VB' in the default NLTK part of speech tagger)
# that appear in tweets from the umsi account
print('*' * 20, '\n\n')
print('***** MOST COMMON VERBS IN UMSI "NEIGHBOR" TWEETS *****')
# Print the 10 most common verbs ('VB' in the default NLTK part of speech tagger)
# that appear in tweets from umsi's "neighbors", giving preference to tweets from
# umsi's most "mentioned" accounts
print('*' * 20, '\n\n')
conn.close()