datasciencecampus / pygrams

Extracts key terminology (n-grams) from any large collection of documents (>1000) and forecasts emergence
https://datasciencecampus.github.io/pygrams
Other
62 stars 23 forks source link

porter emergence algorithm - uncaught divide by zero #381

Open l-bailey-fnc opened 1 year ago

l-bailey-fnc commented 1 year ago

Describe the bug In emergence.py, the calculate_escore() method returns a divide by zero exception when there are quarterly periods with 0 patents in. This occurs on line 72.

Expected behavior divide by zero is handled safely and a sensible result is returned from the calculation.

l-bailey-fnc commented 1 year ago

May only happen if input data is not sorted in ascending date order (oldest at the top of the csv file)