(ngrams: collections.Counter)
return num_repeated / num_total if num_total > 0 else 0
Compute n-gram based repeitition scores.

  Args:
    ngrams: A Counter object mapping each ngram to number of occurrences for the
      text.

  Returns:
    A Score float.
Compute n-gram based repeitition scores.
Compute n - gram based repeitition scores .
def _score_ngrams(ngrams: collections.Counter) -> float:
  """Compute n-gram based repeitition scores.

  Args:
    ngrams: A Counter object mapping each ngram to number of occurrences for the
      text.

  Returns:
    A Score float.
  """
  num_total = sum(ngrams.values())
  num_repeated = sum([c for c in ngrams.values() if c > 1])
  return num_repeated / num_total if num_total > 0 else 0
def _score_ngrams ( ngrams : collections . Counter ) -> float : num_total = sum ( ngrams . values ( ) ) num_repeated = sum ( [ c for c in ngrams . values ( ) if c > 1 ] ) return num_repeated / num_total if num_total > 0 else 0