branch: elpa/writegood-mode
commit a00ba459e799d06243594b1b3f6ac0448dd150ae
Author: Benjamin Beckwith <[email protected]>
Commit: Benjamin Beckwith <[email protected]>
Modified the syllable estimation function
Consecutive syllables are not counted as one. The endings -es -ed and -e
are subtracted from the overall count.
---
writegood-mode.el | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/writegood-mode.el b/writegood-mode.el
index 54b573830f..f45fe717a1 100755
--- a/writegood-mode.el
+++ b/writegood-mode.el
@@ -234,8 +234,13 @@
(how-many (regexp-opt-charset writegood-sentence-punctuation) rstart rend))
(defun writegood-count-syllables (rstart rend)
- "Count the number of syllables in the region bounded by RSTART and REND."
- (how-many (regexp-opt-charset writegood-vowels) rstart rend))
+ "Count the (approximate) number of syllables in the region bounded by RSTART
and REND.
+
+ Consecutive vowels count as one syllable. The endings -es -ed
+ and -e are not counted as syllables.
+ "
+ (- (how-many "[aeiouy]+" rstart rend)
+ (how-many "\\(es\\|ed\\|e\\)\\b" rstart rend)))
(defun writegood-fk-parameters (&optional rstart rend)
"Flesch-Kincaid reading parameters"