cgiffard / TextStatistics.js

Generate information about text including syllable counts and Flesch-Kincaid, Gunning-Fog, Coleman-Liau, SMOG and Automated Readability scores.
MIT License
191 stars 37 forks source link

Syllables are incorrectly counted #4

Closed Anaphase closed 7 years ago

Anaphase commented 10 years ago

Given the sentence:

This sentence has eight syllables.

syllableCount() will return 9. As verified on https://readability-score.com, DaveChild/Text-Statistics returns the correct syllable count of 8.

Anaphase commented 10 years ago

What's odd is that the syllables are correctly counted individually, but when all the words are combined together, the incorrect total is returned.

text_stats.syllableCount('This') === 1
text_stats.syllableCount('sentence') === 2
text_stats.syllableCount('has') === 1
text_stats.syllableCount('eight') === 1
text_stats.syllableCount('syllables') === 3
text_stats.syllableCount('This sentence has eight syllables') === 9 // should be 8...
cgiffard commented 10 years ago

Hrm. This shouldn't be happening! strokes beard

I'll take a look. :)

Anaphase commented 10 years ago

If it helps, I boiled it down to this:

text_stats.syllableCount('This') === 1
text_stats.syllableCount('This sentence') === 3
text_stats.syllableCount('This sentence has') === 5 // should be 4...
cgiffard commented 10 years ago

It looks like its counting the syllables of whitespace. This would really skew down the readability scores. :-/

Anaphase commented 10 years ago

Well, I thought that too, but it doesn't seem consistent. "This has it" correctly returns 3 syllables ¯_(ツ)_/¯

cgiffard commented 10 years ago

OK! I'll go spelunking. :)

karan commented 9 years ago

Any updates on this? I'm thinking of using this module but since it skews the grade level right now, I'd rather not.

JohnMcLear commented 9 years ago
var stats = textstatistics("monkey goes yay");
stats.wordCount();
4

-_-

cgiffard commented 7 years ago

Fixed in #13. Sorry for neglecting this issue for so long!