// For each order of ngram, calculate the no. of ngram matches and
// keep track of no. of ngram in references.
ref_ngrams = Counter(everygrams(reference, min_len, max_len))
hyp_ngrams = Counter(everygrams(hypothesis, min_len, max_len))
overlap_ngrams = ref_ngrams & hyp_ngrams
tp = sum(overlap_ngrams.values()) // True positives.
tpfp = sum(hyp_ngrams.values()) // True positives + False positives.
tpfn = sum(ref_ngrams.values()) // True positives + False negatives.
After Change
// compatibility with previous single-reference API:
if not references or isinstance(references[0], string_types):
references = [references]
return corpus_gleu(