def I(self, w1, r, w2):
        if (w1, r, w2) in self.I_memoized:
            return self.I_memoized[(w1, r, w2)]

        fr_w1rw2 = self.frequencies[w1, r, w2]
        if not fr_w1rw2:
            return 0.0
        fr__r_ = sum(self.frequencies[triple] for triple in self.dt_for_r[r])
        fr_w1r_ = sum(self.frequencies[triple] for triple in self.dt_for_w1r[(w1, r)])
        fr__rw2 = sum(self.frequencies[triple] for triple in self.dt_for_rw2[(r, w2)])
        res = max(math.log(float(fr_w1rw2) * fr__r_ / fr_w1r_ / fr__rw2), 0.0)
        self.I_memoized[(w1, r, w2)] = res
        return res
dataset/ETHPy150Open mikhaildubov/AST-text-analysis/east/synonyms/synonyms.py/SynonymExtractor.I/original