@@ -0,0 +1,859 @@
+#!/usr/bin/env python2%0A%0Aimport yaml%0Aimport json%0Afrom operator import itemgetter%0Afrom lsh_hdc.cluster import HDClustering%0Afrom content_rules import ContentFilter%0Afrom mrjob.job import MRJob%0Afrom pkg_resources import resource_string%0A%0A%0Amac_cfg = yaml.load(resource_string(__name__, 'data/mac.yaml'))%0Ahdc = HDClustering(cfg=mac_cfg%5B'model'%5D,%0A                   content_filter=ContentFilter(),%0A                   get_body=itemgetter('content'),%0A                   get_label=itemgetter('post_id'),%0A                   get_prefix=itemgetter('user_id')%0A                   )%0A%0A%0Aclass MRCluster(MRJob):%0A%0A    def mapper(self, _, data):%0A        obj = json.loads(data)%5B'object'%5D%0A        for x in hdc.mapper(obj):%0A            yield x%0A%0A    def reducer(self, key, val):%0A        yield hdc.reducer((key, val))%0A%0A%0Amrcountpn = MRCluster()%0Aclusters = mrcountpn.run()%0A%0Aprint clusters%0A

add MapReduce version of clustering