Open jrfnl opened 10 years ago
I've got something similar in the code for readability-score that I've been meaning to move over. This looks pretty similar, I think. I was having all sorts of trouble with HTML pages where I was forcing block-level elements to end sentences, so ending up with multiple terminators over multiple lines, but they were all ending the same sentence.
If you have a number of example sentences and such, I'd be quite willing to have a look at figuring out some smart regexes ;-)
I've pushed the latest version of the text cleaning method, which handles sentences better.
I don't have many good examples of tricky text, but will see if I can produce one from an HTML doc. The worst ones tend to end up with something like this, frequently (block elements replaced with periods, heading tend not to have sentence terminators):
Welcome
This is a list item...
. . . .
.
.. .And another
item..
After cleanup, that should look something like this:
Welcome. This is a list item. And another item.
In the inline code comments you already note:
I found it is also tripped up by
...
or?!
Just wanted to show you the below suggestion for consideration as it will at least provide better count in ... and ?! situations: