Hey Huseyin,

···<date: 2012-12-14, Friday>···<from: "H. Özoguz">···

> I am setting with grid-set, and I am wondering, if there is a
> possibility to count the number of words in the lines (not for each
> single line, but in average over all lines).

take a look at this:

    t-wordsperline.mkvi       http://pastebin.com/ZjEY1w1p
    wordsperline.lua          http://pastebin.com/YW2R97Cm

Usage:

    \usemodule[wordsperline]
    \starttext

      \startlinestats
        \dorecurse{42}{%
          \input knuth\par
          \input ward\par
          \input tufte\par
          \input zapf\par
        }
      \stoplinestats

    \stoptext

(Works best with the --silent flag!)

>                                              That would be helpful
> to get a perfectly readably book (words per row is one of these
> readability-measures). That tool could ignore hyphenated words at
> the end of a line, or count it with 0.5, or whatever.

Hyphenated words are counted as half a word on both lines so each
word amounts to exactly one. This does not account for more
complex horizontal material like boxes which may contain words.
Also the word model is extremely simplistic, so some kinds of
punctuation and effects like letter spacing can distort the
values. Thus depending on the content of your document the
figures might not be accurate; ymmv.

(Took a bit longer because initially I planned on placing the
stats in the inner and outer margin for each line. Turns out this
can’t be done with simple (Lua) means in Context because it would
interfere with the margin mechanism. So I had to scrap the first
approach and rewrote it to display stats only at the end of the
document.)

Regards
Philipp


-- 
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments

Attachment: pgpSeEEGeGKRS.pgp
Description: PGP signature

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to