Skip to content

Instantly share code, notes, and snippets.

@xcombelle
Created March 22, 2023 11:05
Show Gist options
  • Save xcombelle/a6baff16004a1f78b3cb77ee47757e38 to your computer and use it in GitHub Desktop.
Save xcombelle/a6baff16004a1f78b3cb77ee47757e38 to your computer and use it in GitHub Desktop.
from collections import Counter
words = "le petit chat est mort le gros chien est rassasié".split()
count=Counter(words )
print(count.most_common())
# resultat
# [('le', 2), ('est', 2), ('petit', 1), ('chat', 1), ('mort', 1), ('gros', 1), ('chien', 1), ('rassasié', 1)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment