charliermarsh / semantic

A Python library for extracting semantic information from text, such as dates and numbers.
MIT License
74 stars 20 forks source link

Fix condition for checking day of week #8

Closed caje731 closed 7 years ago

caje731 commented 8 years ago

This issue occurs while testing with phrases containing "Monday". DateService().extractDate("monday") gave me an "UnboundLocalError: local variable 'd' referenced before assignment". On inspection, I found that "monday" being the first element in the daysOfWeek list, extractDayOfWeek() returns 0, and the condition "elif day_of_week" fails because obviously bool(0) is False. This commit changes the condition to a more explicit one.