bnbeckwith / writegood-mode

Minor mode for Emacs to improve English writing
http://bnbeckwith.com/code/writegood-mode.html
463 stars 31 forks source link

Meaning of the Reading Ease score ? #19

Closed zimoun closed 5 years ago

zimoun commented 6 years ago

Dear,

Thank you for this nice mode.

The Reading Ease score is not straightforward to interpret. Why not add a short comment in the displayed mini-buffer message ? E.g., according to Wikipedia table ?

I propose something in this flavour:


(defun writegood-reading-ease-score->comment (score)
   "Rough meaning of the Flesch-Kincaid reading ease test.                                                                                                         

 From Wikipedia URL `https://en.wikipedia.org/wiki/Flesch–Kincaid_readability_tests'."
   (cond
    ((< score 0) "Ouch! (Proust litterature)")
    ((and (<= 0 score) (< score 30.0)) "Very difficult (college graduate)")
    ((and (<= 30.0 score) (< score 50.0)) "Difficult (almost college)")
    ((and (<= 50.0 score) (< score 60.0)) "Fairly difficult (10-12th grade)")
    ((and (<= 60.0 score) (< score 70.0)) "Plain English (8-9th grade)")
    ((and (<= 70.0 score) (< score 80.0)) "Fairly easy (7th grade)")
    ((and (<= 80.0 score) (< score 90.0)) "Easy (6th grade)")
    ((<= 90.0 score) "Very easy (5th grade)")
   ))

 ;;;###autoload                                                                                                                                                    
 (defun writegood-reading-ease (&optional start end)
   "Flesch-Kincaid reading ease test. Scores roughly between 0 and 100."
    (interactive)
    (let* ((params (writegood-fk-parameters start end))
           (sentences (nth 0 params))
           (words     (nth 1 params))
           (syllables (nth 2 params))
           (score  (- 206.835 (* 1.015 (/ words sentences)) (* 84.6 (/ syllables words)))))
      (message "Flesch-Kincaid reading ease score: %.2f. %s" score
               (writegood-reading-ease-score->comment score)))) 

All the best

bnbeckwith commented 6 years ago

@zimoun do you want to make a PR for review? I think this is a reasonable addition.

zimoun commented 6 years ago

@bnbeckwith PR #21 openned. Thank you.

All the best.