123456789101112131415161718192021222324252627282930313233343536373839404142 |
- from datetime import datetime
- import million.analyze.find_holes as fh
- from million.analyze.word_finder import retain_counts
- import million.parse.fb_exports as fb
-
-
- DATA_PATH = "./data/"
-
- export = fb.parse_dirfiles(DATA_PATH)
-
- filtered = retain_counts(export.messages)
-
- sequences = fh.compute_sequences(filtered)
-
- actual_counted = sum([s.length() for s in sequences])
-
- print(f"Actual counted: {actual_counted}")
-
- merged = fh.merge_duplicates(sequences)
- merged = [s for s in merged if s.length() > 1]
- holes = fh.find_holes(filtered)
-
- print(len(holes))
-
- for hole in holes:
- print(f"{hole.start() + 1} -> {hole.end() - 1} ({hole.length() - 2})")
-
-
- # lets export a csv file of the holes and the people responsible for them
- with open("output/holes.csv", "w") as f:
- f.write("début,fin,taille,responsable1,responsable2,date1,date2\n")
- for hole in holes:
- date_start = hole.start_message.date_time.strftime("%Y-%m-%d %H:%M:%S")
- date_end = hole.end_message.date_time.strftime("%Y-%m-%d %H:%M:%S")
- f.write(
- f"{hole.start()},"
- f"{hole.end()},"
- f"{hole.length()},"
- f"{hole.start_message.sender_name},"
- f"{hole.end_message.sender_name},"
- f"{date_start},{date_end}\n"
- )
|