##// END OF EJS Templates
A number of changes getting ready for a new ipcluster....
A number of changes getting ready for a new ipcluster. * Added argparse.py to IPython/external * New reuse_furls options to ipcontroller. By default the controller will now delete all old furl files unless the -r flag i given. This is needed so engines starting up don't pick up the old furl files. * Minor logic changes in ipengine and engineconnector related to detecting errors relating to furl files.

File last commit:

r1337:53a3e331
r1769:e574479c
Show More
wordfreq_skel.py
17 lines | 526 B | text/x-python | PythonLexer
"""Count the frequencies of words in a string"""
def wordfreq(text):
"""Return a dictionary of words and word counts in a string."""
def print_wordfreq(freqs, n=10):
"""Print the n most common words and counts in the freqs dict."""
words, counts = freqs.keys(), freqs.values()
items = zip(counts, words)
items.sort(reverse=True)
for (count, word) in items[:n]:
print word, count
if __name__ == '__main__':
import gzip
text = gzip.open('HISTORY.gz').read()
freqs = wordfreq(text)