yandexdataschool / nlp_course

YSDA course in Natural Language Processing
https://lena-voita.github.io/nlp_course.html
MIT License
9.79k stars 2.59k forks source link

Additional assert for count_ngrams #156

Open tempoden opened 3 weeks ago

tempoden commented 3 weeks ago

I have spent quite some time trying to find an error in my function to compute perplexity for the case n=1. I got 321 instead of desired 318.

It turns out that the mistake was in count_ngrams, and for the case n=1 I have counted EOS twice. In order to find a similar mistake earlier and spend a little bit less time then I did, I propose to add one more assert for this corner-case.

review-notebook-app[bot] commented 3 weeks ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB