From 7708dafafef72ae2505c3e341660ecfe9fc5ce95 Mon Sep 17 00:00:00 2001 From: "bparodi@lezzo.org" Date: Tue, 5 Nov 2024 15:01:56 +0100 Subject: [PATCH] fuzz --- gather.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/gather.py b/gather.py index 090d954..2f841cb 100644 --- a/gather.py +++ b/gather.py @@ -1,4 +1,5 @@ import json, sys, os, glob +from rapidfuzz import fuzz from collections import namedtuple from dateutil import parser @@ -121,18 +122,25 @@ for k, v in melevisione.items(): if counter.abs != n and counter.rel != n: assert False, f'{ep}|{counter}|stagione={k}' else: - counter = inc(counter) + pass # parsed = Episode(counter.abs, parsed_date, ep.title) ep_ = make(ep.n, ep.date, ep.title, k) date = parse_date(ep_.date) ep_ = WellFormed(counter.abs, date.date(), ep_.title, ep_.season) acc.append(ep_) + counter = inc(counter) counter = reset(counter, k) -EPISODI_TOTALI = len(scarti) + sum(expected.values()) +EPISODI_TOTALI = len(scarti) + sum(expected.values()) - 1 assert acc[-1].n == EPISODI_TOTALI, f'{acc[-1].n} != {EPISODI_TOTALI}' -print(acc) +from copy import copy + +all_episodes = copy(acc) +all_titles = [a.title for a in acc] + +# from IPython import embed as fuck; fuck() +max(all_episodes, key=lambda x: fuzz.ratio(x.title, "la missione di fata"))