[+] Filter by language, reselect sample

This commit is contained in:
Hykilpikonna
2021-11-23 12:10:28 -05:00
parent 3333c5377b
commit b6d0cda387
2 changed files with 5 additions and 2 deletions
+2 -2
View File
@@ -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
+3
View File
@@ -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:]