5 Oct 2012 sness   » (Journeyer)

Tutorial — Disco v0.4.3 documentation

Tutorial — Disco v0.4.3 documentation: "from disco.core import Job, result_iterator

def map(line, params):
for word in line.split():
yield word, 1

def reduce(iter, params):
from disco.util import kvgroup
for word, counts in kvgroup(sorted(iter)):
yield word, sum(counts)

if __name__ == '__main__':
job = Job().run(input=["http://discoproject.org/media/text/chekhov.txt"],
map=map,
reduce=reduce)
for word, count in result_iterator(job.wait(show=True)):
print word, count"

'via Blog this'

Syndicated 2012-10-05 17:56:00 from sness

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!