From 7279ab1e807c471cd294b725c261049414fc60b3 Mon Sep 17 00:00:00 2001 From: Joshua Chin Date: Tue, 7 Jul 2015 15:01:39 -0400 Subject: [PATCH] added docstring to top_n_list Former-commit-id: 0b25caaf243a9f92f8106282d5d7d54dd4214d9c --- wordfreq/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wordfreq/__init__.py b/wordfreq/__init__.py index 574e9e2..6430ee2 100644 --- a/wordfreq/__init__.py +++ b/wordfreq/__init__.py @@ -291,6 +291,11 @@ def word_frequency(word, lang, wordlist='combined', default=0.): @lru_cache(maxsize=100) def top_n_list(lang, n, wordlist='combined', ascii_only=False): + """ + Return a frequency list of length `n` in descending order of frequency. + This list contains words from `wordlist`, of the given language. + If `ascii_only`, then only ascii words are considered. + """ results = [] for word in iter_wordlist(lang, wordlist): if (not ascii_only) or max(word) <= '~':