On Sun, 6 Aug 2006, Mojca Miklavec wrote:
Base on those three answers I got a more clear idea of two (different, but complementary) methods that might be sensible:
a) ctxtools --wordcount filename[tex|pdf] to do the wordcount for the whole document using pdftotext + ruby regexp
b) \usemodule[wordcount]
whatever
\startstatistics[name][words|letters|lines] some more-or-less plain text \stopstatistics
whatever
and according to Aditya's idea, run a (ruby) regular expression (insead of detex) on it which would write the nicely formatted desired number to the output/log file. (I don't know if it's possible to use the first approach for the second problem, but it doesn't make sense to complicate things too much.)
If you have a script that counts words in a Context document, the second approach is straight forward. Write everything to a buffer and run the script on the buffer. However, such a mechansim will never be perfect (or close to perfect) in the sense of parsing arbitrary input. ftp://tug.ctan.org/pub/tex-archive/macros/plain/contrib/misc/xii.tex But of course, you will not write anything like this in an abstract :-) Aditya