def create_predicate(self):
        query_fc = self.get_query_fc()
        sim_feature = get_string_counter(query_fc, self.nilsimsa_feature_name)

        accumulator = dict()
        if sim_feature:
            for nhash in sim_feature:
                accumulator[nhash] = self.query_content_id

        def accumulating_predicate((content_id, fc)):
            sim_feature = get_string_counter(fc, self.nilsimsa_feature_name)
            if not sim_feature:
                return True

            for nhash in sim_feature:
                if accumulator in nhash:
                    # either exact duplicate, or darn close (see
                    # test_nilsimsa_exact_match), so filter it and no
                    # need to update accumulator
                    return False

            for hash1, hash2 in product(sim_feature, accumulator):
                score = nilsimsa.compare_digests(hash1, hash2,
                                                 threshold=self.threshold)
                score /= 128.0
                if score > self.threshold:
                    # near duplicate, so filter and do not accumulate
                    return False

            for nhash in sim_feature:
                accumulator[nhash] = content_id

            # allow it through
            return True

        return accumulating_predicate
dataset/ETHPy150Open dossier/dossier.web/dossier/web/filters.py/nilsimsa_near_duplicates.create_predicate/swapped operands of `in`