使用python对twitter用户进行聚类

2024-04-25 17:22:17 发布

您现在位置:Python中文网/ 问答频道 /正文

我在github(https://github.com/bonzanini/Book-SocialMediaMiningPython/blob/master/Chap02-03/twitter_cluster_users.py)上找到了这段代码,可以根据twitter上的bios使用k-means对用户配置文件进行聚类。我有一个.jsonl文件,其中有以下格式的行:

 {"id": 66634375, "id_str": "66634375", "name": "JonathanvanderGeer", "screen_name": "jonathanvdgeer", "location": "\u00dcT: 52.079226,4.282848", "description": "politiek adviseur van vice-premier en LNV-minister Carola Schouten| gelovig|familiemens|levensgenieter|1984|hardloper|toneel|RvT-lid theaterschool Rabarber"....}

但打印时我需要知道bios的用户名群集。如何我可以吗? 我想在这个集群中添加位置信息。将位置作为第二列添加到矩阵中,并使用这两个特性计算tfidf。我怎么能做到呢?在

^{pr2}$

Tags: namehttpsgithubmastercomidtwitterusers