def addClusterId(self,line):
        """
        :param line:
         reads all the ads in particular cluster, takes the hash of those uri's and appends that as cluster_id
        """
        if isinstance(line,dict):
            jsonObj = line
        else:
            jsonObj = json.loads(line)
        concat_str=''
        for item in jsonObj['cluster']:
            concat_str += item['uri']
        cluster_id = "http://dig.isi.edu/ht/data/" + str(hash(concat_str)% 982451653)
        for item in jsonObj['cluster']:
            item['cluster_id']=cluster_id
            yield item
def addClusterId ( self , line ) : if isinstance ( line , dict ) : jsonObj = line else : jsonObj = json . loads ( line ) concat_str = '' for item in jsonObj [ 'cluster' ] : concat_str += item [ 'uri' ] cluster_id = "http://dig.isi.edu/ht/data/" + str ( hash ( concat_str ) % 982451653 ) for item in jsonObj [ 'cluster' ] : item [ 'cluster_id' ] = cluster_id yield item
:param line:
         reads all the ads in particular cluster, takes the hash of those uri's and appends that as cluster_id