def r_compute_stats(self, prev_word, value):
        """For each pair of words, compute how many times it appears,
        how many times the first word appears in a pair, and the percentage
        of time the second word follows the first.

        This relies on values appearing in sorted order; we need the total
        number of times the first word appears before we can compute the
        percentage for each second word.
        """
        total = None

        for value_type, data in value:
            if value_type == 'A: total':
                total = data
            else:
                assert value_type == 'B: stats'
                word, count = data
                # A comes before B, so total should already be set
                percent = 100.0 * total / count
                yield (prev_word, word), (total, count, percent)
dataset/ETHPy150Open Yelp/mrjob/mrjob/examples/mr_next_word_stats.py/MRNextWordStats.r_compute_stats/swapped operands of `/`