Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: sentenceCount function does not count sentences properly #14

Open
akshitdandyan opened this issue Mar 5, 2024 · 0 comments
Open

Comments

@akshitdandyan
Copy link

akshitdandyan commented Mar 5, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant