From 5d53ec049b3f9887e2333b7a4fa85ffe013e5741 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 20 Oct 2026 14:59:36 +0200 Subject: [PATCH] =?UTF-8?q?Sin=C3=B3nimos=20de=20un=20mismo=20v=C3=ADdeo?= =?UTF-8?q?=20cuentan=20una=20vez;=20lenguas=20->=20Lengua=20=C3=A1rabe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/build.py b/build.py index d019ecc..f6691a2 100644 --- a/build.py +++ b/build.py @@ -82,7 +82,7 @@ STOP = {'podcast', 'podcastclips', 'andaquenosabesna', 'andaquenosabesna', 'aqns 'viral', 'parati', 'galaxoide', 'youtube', 'video', 'clips'} LABELS = { # clave normalizada -> texto a mostrar (sinónimos incluidos) 'egipto': 'Egipto', 'egiptomania': 'Egipto', 'educacion': 'Educación', 'arabe': 'Lengua árabe', - 'lenguas': 'Lenguas', 'religion': 'Religiones', 'religiones': 'Religiones', 'magia': 'Magia', + 'lenguas': 'Lengua árabe', 'religion': 'Religiones', 'religiones': 'Religiones', 'magia': 'Magia', 'burocracia': 'Burocracia', 'poligamia': 'Poligamia', 'economia': 'Economía', 'gastronomia': 'Gastronomía', 'comidaegipcia': 'Comida egipcia', 'robotica': 'Robótica', 'tecnologia': 'Tecnología', 'agricultura': 'Agricultura', 'curiosidades': 'Curiosidades', @@ -97,16 +97,17 @@ def norm(tag): def topics(vids): - count, raw = Counter(), {} + count = Counter() for v in vids: seen = set() for tag in re.findall(r'#(\w+)', v['desc']): k = norm(tag) - if k in STOP or k in seen: + if k in STOP: continue - seen.add(k) label = LABELS.get(k) or (tag[0].upper() + tag[1:]) - raw[label] = label + if label in seen: # sinónimos del mismo vídeo cuentan una sola vez + continue + seen.add(label) count[label] += 1 ranked = [t for t, _ in sorted(count.items(), key=lambda kv: (-kv[1], kv[0]))] out = [t for t in ranked if t not in PINNED][:max(MAX_TOPICS - len(PINNED), 0)]