[+] Filter by language, reselect sample
This commit is contained in:
+2
-2
@@ -22,13 +22,13 @@ if __name__ == '__main__':
|
||||
# Data processing - Step P1
|
||||
# (After step C1) Process the downloaded twitter users, extract screen name, popularity, and
|
||||
# number of tweets data.
|
||||
process_users()
|
||||
# process_users()
|
||||
|
||||
#####################
|
||||
# Data processing - Step P2
|
||||
# (After step P1) Select 500 most popular users and 500 random users who meet a particular
|
||||
# criteria as our sample.
|
||||
# select_user_sample()
|
||||
select_user_sample()
|
||||
|
||||
#####################
|
||||
# Data collection - Step C2.1
|
||||
|
||||
@@ -120,6 +120,9 @@ def select_user_sample(user_dir: str = './data/twitter/user/') -> None:
|
||||
# Load users
|
||||
users = load_users(user_dir)
|
||||
|
||||
# Filter by language first
|
||||
users = [u for u in users if any(lang in u.lang for lang in {'en', 'zh', 'ja'})]
|
||||
|
||||
# Find most popular, and exclude them from the random sample
|
||||
most_popular = users[:500]
|
||||
users = users[500:]
|
||||
|
||||
Reference in New Issue
Block a user