Skip to content

Commit

Permalink
Mod: Format files with black 23.3.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
Labbeti committed May 15, 2023
1 parent 0ec4791 commit 606786d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/aac_metrics/functional/bleu.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def __cook_references(
for ref in refs:
rl, counts = __cook_sentence(ref, n, tokenizer)
reflen.append(rl)
for (ngram, count) in counts.items():
for ngram, count in counts.items():
maxcounts[ngram] = max(maxcounts.get(ngram, 0), count)

# Calculate effective reference sentence length.
Expand Down Expand Up @@ -203,7 +203,7 @@ def __cook_candidate(
result["guess"] = [max(0, testlen - k + 1) for k in range(1, n + 1)]
result["correct"] = [0] * n

for (ngram, count) in counts.items():
for ngram, count in counts.items():
result["correct"][len(ngram) - 1] += min(refmaxcounts.get(ngram, 0), count)

return result
Expand Down
5 changes: 2 additions & 3 deletions src/aac_metrics/functional/cider_d.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def __counter_to_vec(
length = 0
norm = np.zeros((n,))

for (ngram, term_freq) in counters.items():
for ngram, term_freq in counters.items():
if isinstance(doc_frequencies, Mapping):
count = doc_frequencies[ngram]
else:
Expand Down Expand Up @@ -233,7 +233,7 @@ def __similarity(

for ni in range(n):
# ngram
for (ngram, count) in cand_vec[ni].items():
for ngram, count in cand_vec[ni].items():
# vrama91 : added clipping
similarities[ni] += min(count, ref_vec[ni][ngram]) * ref_vec[ni][ngram]

Expand All @@ -255,7 +255,6 @@ def __compute_cider(
sigma: float,
scale: float,
) -> tuple[np.ndarray, list[tuple[list, list]]]:

scores = np.empty((len(cooked_cands),))
tfidf_lst = []

Expand Down

0 comments on commit 606786d

Please sign in to comment.