(self, target: Text, prediction: Text,
            source: Text)
return results
Calculates extractive scores in target_text and prediction_text.

    Args:
      target: human generated text.
      prediction: prediction generated text.
      source: source text of extraction.

    Returns:
      A dict mapping each extractive type to a ExtractiveScore object.
    Raises:
      ValueError: If an invalid extractive type is encountered.
Calculates extractive scores in target_text and prediction_text.
Calculates extractive scores in target_text and prediction_text .
def score(self, target: Text, prediction: Text,
            source: Text) -> Dict[Text, ExtractiveScore]:
    """Calculates extractive scores in target_text and prediction_text.

    Args:
      target: human generated text.
      prediction: prediction generated text.
      source: source text of extraction.

    Returns:
      A dict mapping each extractive type to a ExtractiveScore object.
    Raises:
      ValueError: If an invalid extractive type is encountered.
    """
    target_tokens = self._tokenize(target)
    prediction_tokens = self._tokenize(prediction)
    source_tokens = self._tokenize(source)
    (target_coverage, target_density,
     target_normalized_density) = calculate_coverage_density(
         source_tokens, target_tokens)
    (prediction_coverage, prediction_density,
     prediction_normalized_density) = calculate_coverage_density(
         source_tokens, prediction_tokens)
    results = dict()
    for k in self.extractive_types:
      if k == "coverage":
        results[k] = ExtractiveScore(
            target=target_coverage, prediction=prediction_coverage)
      elif k == "density":
        results[k] = ExtractiveScore(
            target=target_density, prediction=prediction_density)
      elif k == "normalized_density":
        results[k] = ExtractiveScore(
            target=target_normalized_density,
            prediction=prediction_normalized_density)
      else:
        raise ValueError("Invalid extractive type: %s" % k)
    return results
def score ( self , target : Text , prediction : Text , source : Text ) -> Dict [ Text , ExtractiveScore ] : target_tokens = self . _tokenize ( target ) prediction_tokens = self . _tokenize ( prediction ) source_tokens = self . _tokenize ( source ) ( target_coverage , target_density , target_normalized_density ) = calculate_coverage_density ( source_tokens , target_tokens ) ( prediction_coverage , prediction_density , prediction_normalized_density ) = calculate_coverage_density ( source_tokens , prediction_tokens ) results = dict ( ) for k in self . extractive_types : if k == "coverage" : results [ k ] = ExtractiveScore ( target = target_coverage , prediction = prediction_coverage ) elif k == "density" : results [ k ] = ExtractiveScore ( target = target_density , prediction = prediction_density ) elif k == "normalized_density" : results [ k ] = ExtractiveScore ( target = target_normalized_density , prediction = prediction_normalized_density ) else : raise ValueError ( "Invalid extractive type: %s" % k ) return results