    def score_with_weights(self, logits, tags):
        """
        Computes the likelihood score for the given sequence of tags,
        given the provided logits, the transition weights in the CRF model
        and the label weights.
        """
        # Start with transitions from START and to END
        total = self.transitions_from_start[tags[0]] + self.transitions_to_end[tags[-1]]
        # Add in all the intermediate transitions
        for tag, next_tag in zip(tags, tags[1:]):
            total += self.transitions[tag, next_tag]
        # Add in the logits for the observed tags
        for logit, tag in zip(logits, tags):
            total += logit[tag] * self.label_weights[tag]
        return total
Computes the likelihood score for the given sequence of tags,
given the provided logits, the transition weights in the CRF model
and the label weights.
tests/modules/conditional_random_field_test.py