fuzz
This commit is contained in:
parent
6547d869c4
commit
7708dafafe
1 changed files with 11 additions and 3 deletions
14
gather.py
14
gather.py
|
@ -1,4 +1,5 @@
|
||||||
import json, sys, os, glob
|
import json, sys, os, glob
|
||||||
|
from rapidfuzz import fuzz
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from dateutil import parser
|
from dateutil import parser
|
||||||
|
|
||||||
|
@ -121,18 +122,25 @@ for k, v in melevisione.items():
|
||||||
if counter.abs != n and counter.rel != n:
|
if counter.abs != n and counter.rel != n:
|
||||||
assert False, f'{ep}|{counter}|stagione={k}'
|
assert False, f'{ep}|{counter}|stagione={k}'
|
||||||
else:
|
else:
|
||||||
counter = inc(counter)
|
pass
|
||||||
|
|
||||||
# parsed = Episode(counter.abs, parsed_date, ep.title)
|
# parsed = Episode(counter.abs, parsed_date, ep.title)
|
||||||
ep_ = make(ep.n, ep.date, ep.title, k)
|
ep_ = make(ep.n, ep.date, ep.title, k)
|
||||||
date = parse_date(ep_.date)
|
date = parse_date(ep_.date)
|
||||||
ep_ = WellFormed(counter.abs, date.date(), ep_.title, ep_.season)
|
ep_ = WellFormed(counter.abs, date.date(), ep_.title, ep_.season)
|
||||||
acc.append(ep_)
|
acc.append(ep_)
|
||||||
|
counter = inc(counter)
|
||||||
|
|
||||||
counter = reset(counter, k)
|
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}'
|
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"))
|
||||||
|
|
Loading…
Reference in a new issue