Closed box-key closed 4 years ago
Also, this if statement seems redundant as the condition is passed into min function.
https://github.com/box-key/cyzil/blob/9907a51a815daea610e1dfb1d3fb2e4db7971304/src/bleu.pyx#L26
I can change this code to:
c2 = m2.count(t1)
if c2:
overlap[t1] = min(c1, c2)
I ended up using map.find() instead of map.count() because the time complexity of map.find() is O(1) whereas the time complexity of map.count() is O(n).
If the sentence length is less than n gram order, it should skip the following loop. https://github.com/box-key/cyzil/blob/9907a51a815daea610e1dfb1d3fb2e4db7971304/src/bleu.pyx#L40