ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Count the words per line
@ 2012-12-14 11:57 "H. Özoguz"
  2012-12-17 18:30 ` Philipp Gesang
  0 siblings, 1 reply; 2+ messages in thread
From: "H. Özoguz" @ 2012-12-14 11:57 UTC (permalink / raw)
  To: ntg-context

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). 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.

Thanks
Huseyin
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Count the words per line
  2012-12-14 11:57 Count the words per line "H. Özoguz"
@ 2012-12-17 18:30 ` Philipp Gesang
  0 siblings, 0 replies; 2+ messages in thread
From: Philipp Gesang @ 2012-12-17 18:30 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1888 bytes --]

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 #1.2: Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-12-17 18:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-14 11:57 Count the words per line "H. Özoguz"
2012-12-17 18:30 ` Philipp Gesang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).