Applies a diff to the label table.

        A ``diff`` is a dictionary with three keys: ``add``, ``delete``
        and ``change``. Each key should map to a list of labels.

        ``add`` corresponds to the labels that are in ``new`` but not in
        ``old``.

        ``delete`` corresponds to the labels that are in ``old`` but not
        in ``new``.

        ``change`` corresponds to the labels that are in both ``old``
        and ``new`` but have different coref/rating values.

def apply_diff(self, diff):
        '''Applies a diff to the label table.

        A ``diff`` is a dictionary with three keys: ``add``, ``delete``
        and ``change``. Each key should map to a list of labels.

        ``add`` corresponds to the labels that are in ``new`` but not in
        ``old``.

        ``delete`` corresponds to the labels that are in ``old`` but not
        in ``new``.

        ``change`` corresponds to the labels that are in both ``old``
        and ``new`` but have different coref/rating values.
        '''
        # add and change are easy---just put the labels.
        # delete is a little trickier. We need to scrub out the impact of
        # the previous label without actually deleting it. For this, we
        # use an unknown coref value.
        insert = (
            diff['add'] +
            diff['change'] +
            [lab.update(value=CorefValue.Unknown)
             for lab in diff['delete']]
        )
        self.put(*insert)