utils.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:wymapreduce 作者: ring04h 项目源码 文件源码
def reducer():
    current_job = get_current_job(redis_conn)
    words = current_job.dependency.result

    # we should generate sorted lists which are then merged,
    # but to keep things simple, we use dicts
    word_count = {}
    for word, count in words:
        if word not in word_count:
            word_count[word] = 0
        word_count[word] += count
    # print('reducer: %s to %s' % (len(words), len(word_count)))
    return word_count
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号