diff --git a/TPC3/main.py b/TPC3/main.py index 8d9cdd1..f609303 100644 --- a/TPC3/main.py +++ b/TPC3/main.py @@ -1,7 +1,6 @@ import re from dataclasses import dataclass -processes = {} alinea_a = {} @@ -24,14 +23,26 @@ class Line: mom: str associated_processes: list[Process] +processes : dict[int,dict[int,dict[int,list[Line]]]] = {} def main(): load() - print(processes) + freq_proc_ano() +def freq_proc_ano(): + freq = {} + for year in processes.keys(): + for month in processes[year].keys(): + for day in processes[year][month].keys(): + if year not in freq: + freq[year] = 0 + freq[year] += 1 + +def freq_nomes_apelidos(): + print("a") def load(): - regex = r"(\d+)::(\d+)-(\d+)-(\d+)::([A-Za-z ]+)::([A-Za-z ]+)::([A-Za-z ]+)::(([^ \n]* *)*)::" + regex = r"(\d+)::(\d+)-(\d+)-(\d+)::([A-Za-z ]+)::([A-Za-z ]+)::([A-Za-z ]+)::(.*)::" dataset = open("processos.txt", "r") lines = dataset.readlines() for line in lines: @@ -50,7 +61,7 @@ def load(): proc_str = matched_regex.group(8) regex2 = r"([A-Za-z ]+),([A-Za-z ]+)\. Proc\.(\d+)\. *" proc_match = re.findall(regex2, proc_str) - + proc_list = [] if proc_match is not None: for match in proc_match: @@ -59,11 +70,11 @@ def load(): ) line_obj = Line(folder, year, month, day, name, dad, mom, proc_list) - if year not in processes: + if year not in processes.keys(): processes[year] = {} - if month not in processes[year]: + if month not in processes[year].keys(): processes[year][month] = {} - if day not in processes[year][month]: + if day not in processes[year][month].keys(): processes[year][month][day] = [] processes[year][month][day].append(line_obj)