Skip to content

Instantly share code, notes, and snippets.

@kungming2
Created November 30, 2019 07:26
Show Gist options
  • Save kungming2/d1a24da509e24afa22d64cca295370d0 to your computer and use it in GitHub Desktop.
Save kungming2/d1a24da509e24afa22d64cca295370d0 to your computer and use it in GitHub Desktop.
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