Reading level

Everything related to our flagship word processor.
Post Reply
kmkohler
Posts: 12
Joined: 2008-05-25 10:13:49
Location: Corvallis, OR

Reading level

Post by kmkohler »

Nisus Writer Classic had a command to compute the reading/grade level of text. This appears to have gone missing in Pro.
Since macros have been made more powerful, I'd guess this could be done with a macro. Has anyone done it?
For me Perl is a read-only language (and that's shaky) so I'm not going to be the one to do it!
User avatar
martin
Official Nisus Person
Posts: 5230
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Reading level

Post by martin »

Such a macro could be written, even if it was complicated. Defining what constitutes a syllable is always murky business. If anyone does construct such a macro, please do share it :) I know adding back in the Flesch reading score is on the list of features we'd like to add, but I couldn't say when it might appear.
kmkohler
Posts: 12
Joined: 2008-05-25 10:13:49
Location: Corvallis, OR

Re: Reading level

Post by kmkohler »

I should have done this first! Some googling found a perl module that does the heavy lifting (Lingua:EN:Fathom). I've created a script that seems to work. The remaining question is how to package the perl modules with the Nisus macro so users don't have to download anything besides the macro.

My script puts up a Prompt dialog with a number of statistics about the body of the currently active document. One minor annoyance is that the formatting is ugly because the Perl code assume a fixed-width font. Is there an easy way to fix that? Should the results be put in a new document instead of a Prompt?

Here it is

# Display Reading Level statistics for the body of the currently active document.
#
$doc = Document.active
$body = $doc.text
$result = “”
Begin Perl
use Lingua::EN::Fathom;
my $text = new Lingua::EN::Fathom;
$text->analyse_block($body);
$result = $text->report;
End
Prompt $result
User avatar
martin
Official Nisus Person
Posts: 5230
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Reading level

Post by martin »

That was quick work on your part! Good old Perl with its host of modules.
kmkohler wrote:The remaining question is how to package the perl modules with the Nisus macro so users don't have to download anything besides the macro.
I don't think this would be too hard. It would just be a matter of copying the relevant bits of perl code from the required Lingua modules (Lingua::EN::Fathom and Lingua::EN::Syllable) into the Nisus macro's Perl block. I couldn't comment on whether that was legally permitted by the module licenses.
One minor annoyance is that the formatting is ugly because the Perl code assume a fixed-width font. Is there an easy way to fix that? Should the results be put in a new document instead of a Prompt?
There's no way to put up a prompt in a fixed width font, so a new document is probably your best option. Here's some code to do just that with the $result variable:

Code: Select all

# show result in a new document with fixed width font
New
Insert Text $result
Font:Courier

# make the document easy to quickly close without being prompted
$doc = Document.active
$doc.clearUndoHistory
kmkohler
Posts: 12
Joined: 2008-05-25 10:13:49
Location: Corvallis, OR

Re: Reading level

Post by kmkohler »

Just to let everyone know... I haven't given up on this, but the process of integrating the Perl code into the macro didn't go smoothly. I've turned it over to a Perl expert so he can figure out what's wrong, but he hasn't had time to look at it yet.
gombi
Posts: 2
Joined: 2008-09-05 00:18:54

Re: Reading level

Post by gombi »

I used to use the reading grade assessment tool a long time ago. Stopped using Nisus and have just returned to the fold. Meantime, I have been using a simple little program called Flesh - have a look at http://flesh.sourceforge.net.
kmkohler
Posts: 12
Joined: 2008-05-25 10:13:49
Location: Corvallis, OR

Re: Reading level

Post by kmkohler »

Just a progress (or lack of progress) report. I got the modified code back from the Perl expert, but although it works standalone, it doesn't work after being integrated into the Nisus script. I've been kind of busy lately, but I'll try to get back to it.
User avatar
greenmorpher
Posts: 767
Joined: 2007-04-12 04:01:46
Location: Melbourne, Australia
Contact:

Re: Reading level

Post by greenmorpher »

Hello gombi

So could it be Ap[plescripted so that anyone unfortunate (or masochistic) enough to have work under the horrible strictures of Flesch could save the NWP/E document, launch Flesh, open the document in Flesh, and get the Flesch scores?

I avoid the sins of the Flesch by taking no notice of it, personally.

Cheers, Geoff

Geoffrey Heard, Business Writer & Publisher

"Type & Layout: Are you communicating or just making pretty shapes", the secrets of how type can help you to sell or influence, and "How to Start and Produce a magazine or Newsletter", now at the new low price of $29.95. See these books and more at http://www.worsleypress.com or Amazon.
gombi
Posts: 2
Joined: 2008-09-05 00:18:54

Re: Reading level

Post by gombi »

I open Flesh and choose the Nisus file - it doesn't open it - tells me in one second that it has:

Flesch-Kincaid 5.32
Flesch Reading Ease 80.92

Also gives break down of words [19,494] sentences, syllables, av syllables/word, av words/sentence

I am not going to lose sleep over the results, nor query what it calls syllables or words - but it very quickly gives me a rough guide to readability. Can recommend it as quick and easy if you don't want to get too excited by how it works!
Post Reply