Issue
The function sentenceCount uses this regular expression to calculate total sentences: (/ *[.?!]['")\]]*[ |\n](?=[A-Z])/g)
It works well when we have text separated by single \n but when there are multiple new lines in between the text, it does not split them properly.
Possible Fix
I suggest a fix: After getting sentences from regular expression mentioned above, we should split each by \n and consider each splitted string as new sentence if it's word count is greater than 3.
How did I find it?
I was matching text-readability fleschReadingEase score with some other tools like https://www.webfx.com/tools/read-able and https://charactercalculator.com/flesch-reading-ease/
There was a big difference in both scores, so I decided to look into library and found this issue in sentence counting part.
I would love to contribute and fix this, please assign me.
Issue
The function
sentenceCountuses this regular expression to calculate total sentences:(/ *[.?!]['")\]]*[ |\n](?=[A-Z])/g)It works well when we have text separated by single
\nbut when there are multiple new lines in between the text, it does not split them properly.Possible Fix
I suggest a fix: After getting sentences from regular expression mentioned above, we should split each by
\nand consider each splitted string as new sentence if it's word count is greater than 3.How did I find it?
I was matching
text-readabilityfleschReadingEase score with some other tools like https://www.webfx.com/tools/read-able and https://charactercalculator.com/flesch-reading-ease/There was a big difference in both scores, so I decided to look into library and found this issue in sentence counting part.
I would love to contribute and fix this, please assign me.