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 815B

123456789101112131415161718192021222324252627
  1. from datetime import datetime
  2. from million.analyze.wordFinder import findWords
  3. from million.parse.fb_exports import FacebookExportParser
  4. DATA_PATH = './data/'
  5. parser = FacebookExportParser()
  6. export = parser.parse(DATA_PATH)
  7. gros_mots = ['merde', 'sexe', 'pute', 'putain', 'bite', 'nichon', 'con(ne)?', 'baiser?']
  8. msg_gros_mots = findWords(export.messages, gros_mots)
  9. msg_gros_mots_grp = {}
  10. for msg in msg_gros_mots:
  11. if msg.sender_name not in msg_gros_mots_grp: msg_gros_mots_grp[msg.sender_name] = []
  12. msg_gros_mots_grp[msg.sender_name].append(msg)
  13. for name in msg_gros_mots_grp:
  14. print(name)
  15. for msg in msg_gros_mots_grp[name]:
  16. time = datetime.fromtimestamp(msg.timestamp_ms / 1000)
  17. time_str = time.strftime("%d/%m/%Y %H:%M:%S")
  18. print(f"\t{time_str} : {msg.content}")