yooper / php-text-analysis

PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language
https://github.com/yooper/php-text-analysis/wiki
MIT License
527 stars 87 forks source link

Fixed polarity bug getting 'Undefined offset: 1' along with normalization bug getting Divison by zero error. #64

Closed hartmann-lars closed 4 years ago

hartmann-lars commented 4 years ago

When looking for the word 'of' after 'kind' where 'kind' is the last word in the sentence it will cause a lookup at an not existing index in the array.

Also fixing normalize divison by zero issue. The following trump tweet was tokenized in the unit test as it resolves to zero.

If the Fake News Opposition Party is pushing, with all their might, the fact that President Trump “ignored early warnings about the threat,” then why did Media & Dems viciously criticize me when I instituted a Travel Ban on China? They said “early & not necessary.” Corrupt Media!

yooper commented 4 years ago

Thank you for the contributions!

hartmann-lars commented 4 years ago

Thank you too for sharing your great work. Best solution out there for PHP 2020 IMO.