You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

find_gromots.py 884B

1234567891011121314151617181920212223242526272829303132333435363738
  1. from million.analyze.word_finder import filter_words
  2. import million.parse.fb_exports as fb
  3. DATA_PATH = './data/'
  4. gros_mots = [
  5. '.*merde.*',
  6. 'sexe',
  7. 'pute',
  8. 'pé?dé?',
  9. 'putain',
  10. 'bite',
  11. 'encul.*',
  12. 'cul',
  13. 'nichon',
  14. 'gueule',
  15. 'con(ne)?',
  16. 'chatte',
  17. 'niqu.*',
  18. 'chi(é|e).*',
  19. 'bais.*'
  20. ]
  21. export = fb.parse_dirfiles(DATA_PATH)
  22. msg_gros_mots = filter_words(export.messages, gros_mots)
  23. msg_gros_mots_grp = {}
  24. for msg in msg_gros_mots:
  25. if msg.sender_name not in msg_gros_mots_grp: msg_gros_mots_grp[msg.sender_name] = []
  26. msg_gros_mots_grp[msg.sender_name].append(msg)
  27. for name in sorted(msg_gros_mots_grp, key = lambda k: len(msg_gros_mots_grp[k])):
  28. print(name)
  29. for msg in msg_gros_mots_grp[name]:
  30. time_str = msg.date_time.strftime("%d/%m/%Y %H:%M:%S")
  31. print(f"\t{time_str} : {msg.content}")