Skip to content

Commit

Permalink
sort before grouping in language counts
Browse files Browse the repository at this point in the history
  • Loading branch information
elfkuzco committed Oct 24, 2024
1 parent 1cfc4c1 commit 66c6fe4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ted2zim/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,19 +349,19 @@ 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)
)
}

# count the number of videos per subtitle language
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"]
]
)
)
}

Expand Down

0 comments on commit 66c6fe4

Please sign in to comment.