1if not modules then modules = { } end modules ['s-languages-frequencies'] = {
2 version = 1.001,
3 comment = "companion to s-languages-frequencies.mkiv",
4 author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
5 copyright = "PRAGMA ADE / ConTeXt Development Team",
6 license = "see context related readme files"
7}
8
9moduledata.languages = moduledata.languages or { }
10moduledata.languages.frequencies = moduledata.languages.frequencies or { }
11
12function moduledata.languages.frequencies.showlist(specification)
13 specification = interfaces.checkedspecification(specification)
14 local t = languages.frequencies.getdata(specification.language or languages.current())
15 context.starttabulate { "|lT|cw(2em)|r|" }
16 context.NC()
17 context.formatted.rlap("%s: %p",t.language,languages.frequencies.averagecharwidth(t.language))
18 context.NC()
19 context.NC()
20 context.NR()
21 context.HL()
22 for k, v in table.sortedhash(t.frequencies) do
23 context.NC()
24 context("%U",k)
25 context.NC()
26 context("%c",k)
27 context.NC()
28 context("%0.3f",v)
29 context.NC()
30 context.NR()
31 end
32 context.stoptabulate()
33end
34
35
36
37
38 |