Created
November 30, 2019 07:26
-
-
Save kungming2/d1a24da509e24afa22d64cca295370d0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import difflib | |
import praw | |
def unique_fetched(): | |
master_dict = {} | |
times_to_check = 11 | |
i = 0 | |
fetch_limit = 151 | |
while i < times_to_check: | |
print("\nGetting round {}...".format(i+1)) | |
posts = list(reddit.subreddit('mod').new(limit=fetch_limit)) | |
posts.reverse() | |
master_dict[i] = [x.id for x in posts] | |
i += 1 | |
print('-------------') | |
return master_dict | |
def process_data(): | |
data = unique_fetched() | |
print("Set Number | % Similarity Compared to Set Zero\n-----------|----------------------------------") | |
for seq in data: | |
try: | |
sm = difflib.SequenceMatcher(None, data[seq], data[seq+1]) | |
print("| Set {} | {:.2%} similarity |".format(seq + 1, sm.ratio())) | |
except KeyError: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment