(document_tokens, summary_tokens)
return coverage, density, normalized_density
Calculate coverage density from document tokens and summary tokens.
Calculate coverage density from document tokens and summary tokens.
Calculate coverage density from document tokens and summary tokens .
def calculate_coverage_density(document_tokens, summary_tokens):
  """Calculate coverage density from document tokens and summary tokens."""
  if not summary_tokens:
    return 0., 0., 0.
  fragments = _greedily_extract(document_tokens, summary_tokens)
  summary_len = float(len(summary_tokens))
  coverage = sum([len(fragment) for fragment in fragments]) / summary_len
  density = sum([len(fragment)**2 for fragment in fragments]) / summary_len
  normalized_density = density / summary_len
  return coverage, density, normalized_density
def calculate_coverage_density ( document_tokens , summary_tokens ) : if not summary_tokens : return 0. , 0. , 0. fragments = _greedily_extract ( document_tokens , summary_tokens ) summary_len = float ( len ( summary_tokens ) ) coverage = sum ( [ len ( fragment ) for fragment in fragments ] ) / summary_len density = sum ( [ len ( fragment ) ** 2 for fragment in fragments ] ) / summary_len normalized_density = density / summary_len return coverage , density , normalized_density