class_docstr: An abstract class that computes the semantic similarity score between
      original text and adversarial texts
  
  :param ~textflint.input.dataset origin_dataset:
          the dataset of origin sample
  :param ~textflint.input.dataset trans_dataset:
      the dataset of translate sample
  :param str|list fields: the name of the origin field need compare.
  :param bool need_tokens: if we need tokenize the sentence
docstr: Calculate the score of the deformed sentence
  
  :return list: a list of translate sentence score
code: def score(self):
      r"""
      Calculate the score of the deformed sentence
  
      :return list: a list of translate sentence score
  
      """
      if not self._score:
          self.check_data()
          self._score = []
  
          for trans_sample in self.trans_dataset:
              for field in self.fields:
                  score = []
                  trans = (
                      trans_sample.get_words(field)
                      if self.need_tokens
                      else trans_sample.get_text(field)
                  )
  
                  ori = self.ori_dataset[
                      self.id2loc[trans_sample.sample_id]
                  ]
                  ori = (
                      ori.get_words(field)
                      if self.need_tokens
                      else ori.get_text(field)
                  )
                  score.append(self.validate(trans, ori))
  
              self._score.append(numpy.mean(score))
          assert len(self._score) == len(
              self.trans_dataset
          ), "The len of the score not equal transset."
  
      return self._score
  
file_path: textflint/textflint/generation/validator/validator.py
imports: import numpy
  from abc import ABC, abstractmethod
  from ...input.dataset.dataset import *
label_desc: Use image node_id 4 for calling the Validator obj's underlying member method code with example usage: obj.score() and returns: self