From 66c6fe4a96eeb550d2ebfb671b3470e02d3f878c Mon Sep 17 00:00:00 2001 From: Uchechukwu Orji Date: Thu, 24 Oct 2024 19:46:43 +0100 Subject: [PATCH] sort before grouping in language counts --- src/ted2zim/scraper.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ted2zim/scraper.py b/src/ted2zim/scraper.py index d601bc3..4ab80f3 100644 --- a/src/ted2zim/scraper.py +++ b/src/ted2zim/scraper.py @@ -349,7 +349,7 @@ def compute_zim_languages(self): audio_lang_counts = { lang: len(list(group)) for lang, group in groupby( - [video["native_talk_language"] for video in self.videos] + sorted(video["native_talk_language"] for video in self.videos) ) } @@ -357,11 +357,11 @@ def compute_zim_languages(self): subtitle_lang_counts = { lang: len(list(group)) for lang, group in groupby( - [ + sorted( subtitle["languageCode"] for video in self.videos for subtitle in video["subtitles"] - ] + ) ) }