[NTG-context] extracting word count from a *.words file

Jelle Huisman jelle at jhnet.nl
Fri Apr 20 23:02:33 CEST 2012


On 04/20/2012 04:53 PM, Philipp Gesang wrote:
> Hi again,
> 
> On 2012-04-20 16:32, Jelle Huisman wrote:
>> Hello all,
>>
>> Here is another question. Consider this test file:
>>
>> \starttext
>> \setupspellchecking[state=start,method=2]
>> \ctxlua{languages.words.threshold=3}
>> \input knuth
>> \stoptext
>>
>> Typesetting this file produces a word list 'test.words' which ends like
>> this:
>>
>>  ["threshold"]=1,
>>  ["total"]=122,
>>  ["version"]=1,
>> }
>>
>> Is there a way to extract the value for ["total"] ('122' in this case)
>> so that I can use that value somewhere else, e.g. in a project file
>> where I want to present a word count.
> 
> The “.words”-file is well formed Lua code, so you can just
> integrate it as a table:

Thank you, Philip, this is a clean solution.

Jelle



More information about the ntg-context mailing list