On 3/19/2021 9:49 PM, denis.ma...@ub.unibe.ch wrote:
Wow, Hans, that looks awesome. Thanks a lot.

Regarding the first output: What are the numbers intended to mean?

The number of time that this word was used hyphenated (the same word can of course end up hyphenated differently in the paragraph).

In the second example we're talking in terms of lines in the input file, right?

No, the linenumber but because I use a loop it's all the same line; in practice these numbers point you to the paragraph start which is good enough.

If so, would it make sense to add some more context? Like so, or similar:

hyhenated       > around line 244 ( "our marvelous and everyday capacity to 
select") in file hup.tex: every-day

As said, normally you have that info (I can probably add the offset but i assume that one is not going to check every hyphenation.)

In any case, that's already super conventient. I'll put together a script to 
compare hyphenations with a whitelist and upload that to the wiki once it's 
ready.

What's the performance hit of all this? (I mean should you disable this and 
only run when needed, or can you safely leave the trackers enabled?)

measures on my 2013 laptop: a 1000 times \samplefile{tufte}\par takes:

pagella:

1000 steps, 4.140 seconds, 0.004140215 per step
1000 steps, 4.222 seconds, 0.004221645 per step

runtime: 4.937 seconds, 250 processed pages, 250 shipped pages, 50.635 pages/second

latin modern:

1000 steps, 2.947 seconds, 0.002947476 per step
1000 steps, 3.043 seconds, 0.003042808 per step

runtime: 3.549 seconds, 223 processed pages, 223 shipped pages, 62.840 pages/second

so not really a problem and i can probaby make it a bit faster (but we need to keep up with the urban myth that context is the slower system)

(it's not something i'd turn on by default)


Thanks again for your help!

Denis

-----Ursprüngliche Nachricht-----
Von: Hans Hagen <j.ha...@xs4all.nl>
Gesendet: Freitag, 19. März 2021 19:09
An: Maier, Denis Christian (UB) <denis.ma...@ub.unibe.ch>; ntg-context@ntg.nl
Betreff: Re: AW: [NTG-context] Keeping track of hyphenations

On 3/19/2021 1:00 PM, denis.ma...@ub.unibe.ch wrote:
----Ursprüngliche Nachricht-----
Von: Hans Hagen <j.ha...@xs4all.nl>
Gesendet: Freitag, 19. März 2021 12:44
An: mailing list for ConTeXt users <ntg-context@ntg.nl>; Maier, Denis
Christian (UB) <denis.ma...@ub.unibe.ch>
Betreff: Re: [NTG-context] Keeping track of hyphenations

On 3/19/2021 11:47 AM, denis.ma...@ub.unibe.ch wrote:
Hi

Is there  a way to conveniently track hyphenations ? I've had a look
at https://wiki.contextgarden.net/Trackers
<https://wiki.contextgarden.net/Trackers> but couldn't find anything.
depends on what you want to track

Something like this: Add every hyphenated word to the log file, like
hyphenations > 'What-ever' , realpage 1, userpage 1, subpage 1
hyphenations > 'Some-thing', realpage 2, userpage 2, subpage 2

You could then feed that into a script to produce a lists of all kinds, e.g., 
each hyphenation only once, sorted by page or by letter, with or without 
information about pages.
Forget about specific pagenumbers ... pages can get broken in the middle
    of a paragraph and it's not worth the trouble of keeping track of / 
analyzing that detail (as usual all can be done but these are features that 
hardly anyone uses, get forgotten and probably no one can find where it's 
documents because no one expects it).

Anyway, a pre-weekend distaction:

\starttext

\enabletrackers[hyphenation.applied]
\enabletrackers[hyphenation.applied.console]

\dontcomplain \dostepwiserecurse{0}{15}{1}{
      {\advance\hsize -#1cm \input tufte \par} }

\stoptext

This will give you in the log file (first and second); the test run has narrow 
lines where one word crossed several lines, which actually is the main 
complication here:

hyhenated       > start hyphenated words

hyhenated       >    2 : ab-stract,
hyhenated       >    1 : ag-gre-gate,
hyhenated       >    3 : ag-gregate,
hyhenated       >    3 : aggre-gate,
hyhenated       >    1 : ap-prox-i-mate,
hyhenated       >    2 : ap-proximate,
hyhenated       >    3 : approx-imate,
hyhenated       >    1 : approxi-mate,
hyhenated       >    1 : av-er-age,
hyhenated       >    1 : av-erage,
hyhenated       >    3 : be-cause
hyhenated       >    1 : ca-pac-ity
hyhenated       >    4 : ca-pacity
hyhenated       >    1 : capac-ity
hyhenated       >    1 : cat-a-log,
hyhenated       >    2 : cat-alog,
hyhenated       >    1 : cat-e-go-rize,
hyhenated       >    3 : cat-egorize,
hyhenated       >    1 : cata-log,
hyhenated       >    1 : cate-gorize,
hyhenated       >    2 : catego-rize,
hyhenated       >    3 : clas-sify,
hyhenated       >    3 : clus-ter,
hyhenated       >    3 : con-dense,
hyhenated       >    1 : dis-crim-i-nate,
hyhenated       >    1 : dis-crimi-nate,
hyhenated       >    1 : dis-criminate,
hyhenated       >    1 : dis-tin-guish,
hyhenated       >    3 : dis-tinguish,
hyhenated       >    2 : discrim-inate,
hyhenated       >    2 : distin-guish,
hyhenated       >    1 : enu-mer-ate,
hyhenated       >    2 : enu-merate,
hyhenated       >    1 : enumer-ate,
hyhenated       >    5 : every-day
hyhenated       >    3 : fil-ter,
hyhenated       >    2 : fo-cus,
hyhenated       >    1 : har-mo-nize,
hyhenated       >    1 : har-monize,
hyhenated       >    2 : harmo-nize,
hyhenated       >    6 : high-light,
hyhenated       >    1 : ide-al-ize,
hyhenated       >    2 : ide-alize,
hyhenated       >    1 : ideal-ize,
hyhenated       >    1 : in-for-ma-tion
hyhenated       >    1 : in-forma-tionthick
hyhenated       >    1 : in-formationthick
hyhenated       >    3 : in-spect,
hyhenated       >    1 : in-te-grate,
hyhenated       >    2 : in-tegrate,
hyhenated       >    1 : informa-tionthick
hyhenated       >    3 : inte-grate,
hyhenated       >    5 : iso-late,
hyhenated       >    4 : item-ize,
hyhenated       >    3 : mar-velous
hyhenated       >    1 : or-ga-nize,
hyhenated       >    1 : orga-nize,
hyhenated       >    5 : out-line,
hyhenated       >    1 : pi-geon-hole,
hyhenated       >    6 : pigeon-hole,
hyhenated       >    3 : re-duce,
hyhenated       >    4 : re-fine,
hyhenated       >    2 : re-view,
hyhenated       >    4 : se-lect,
hyhenated       >    1 : sep-a-rate
hyhenated       >    1 : sepa-rate
hyhenated       >    3 : sin-gle
hyhenated       >    4 : struc-ture,
hyhenated       >    1 : sum-ma-rize,
hyhenated       >    4 : sum-marize,
hyhenated       >    1 : summa-rize,
hyhenated       >    1 : syn-op-size,
hyhenated       >    2 : syn-opsize,
hyhenated       >    1 : syn-the-size,
hyhenated       >    3 : syn-thesize,
hyhenated       >    1 : synop-size,
hyhenated       >    2 : synthe-size,
hyhenated       >    5 : win-now

hyhenated       > stop hyphenated words

and on the console and log (second tracker) lots of

pages           > flushing realpage 2, userpage 2, subpage 2, total
0.482, page 0.011, average 0.482
open source     > level 2, order 13, name 'tufte.tex'
close source    > level 2, order 13, name 'tufte.tex'
hyhenated       > around line 244 in file hup.tex: every-day
hyhenated       > around line 244 in file hup.tex: cat-egorize,
hyhenated       > around line 244 in file hup.tex: dis-criminate,
hyhenated       > around line 244 in file hup.tex: pigeon-hole,
hyhenated       > around line 244 in file hup.tex: aggre-gate,
hyhenated       > around line 244 in file hup.tex: re-view,
hyhenated       > around line 244 in file hup.tex: enu-merate,
open source     > level 2, order 14, name 'tufte.tex'
close source    > level 2, order 14, name 'tufte.tex'
hyhenated       > around line 244 in file hup.tex: every-day
hyhenated       > around line 244 in file hup.tex: synthe-size,
hyhenated       > around line 244 in file hup.tex: re-duce,
hyhenated       > around line 244 in file hup.tex: catego-rize,
hyhenated       > around line 244 in file hup.tex: inte-grate,
hyhenated       > around line 244 in file hup.tex: ap-proximate,
hyhenated       > around line 244 in file hup.tex: out-line,
hyhenated       > around line 244 in file hup.tex: win-now

if you want more you need to analyze the log file

(you have to wait till i update, which will not happen today)

Hans


-----------------------------------------------------------------
                                            Hans Hagen | PRAGMA ADE
                Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
         tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------



--

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to