Skip to content
This repository has been archived by the owner on Mar 11, 2023. It is now read-only.

Math error #53

Closed
JulienPalard opened this issue May 20, 2020 · 3 comments · Fixed by #87
Closed

Math error #53

JulienPalard opened this issue May 20, 2020 · 3 comments · Fixed by #87
Assignees

Comments

@JulienPalard
Copy link
Collaborator

Using the repository: https://github.com/raulcd/python-docs-es
And the command: potodo --offline --path c-api/
I find strange results in c-api:

# c-api (47.03% done)

- abstract.po                      3 /   3 (100.0% translated)
- allocation.po                    9 /   9 (100.0% translated)
- apiabiversion.po                22 /  22 (100.0% translated)
- arg.po                           0 / 192 (  0.0% translated)
- bool.po                          8 /   8 (100.0% translated)
- buffer.po                        0 / 102 (  0.0% translated)
- bytearray.po                    17 /  17 (100.0% translated)
- bytes.po                         0 /  60 (  0.0% translated)
- capsule.po                       0 /  29 (  0.0% translated)
- cell.po                         10 /  10 (100.0% translated)
- code.po                          9 /   9 (100.0% translated)
- codec.po                         0 /  27 (  0.0% translated)
- complex.po                       0 /  25 (  0.0% translated)
- concrete.po                     11 /  11 (100.0% translated)
- contextvars.po                   0 /  31 (  0.0% translated)
- conversion.po                   22 /  27 ( 81.0% translated), 5 fuzzy
- coro.po                          0 /   6 (  0.0% translated)
- datetime.po                      0 /  41 (  0.0% translated)
- descriptor.po                    4 /   4 (100.0% translated)
- dict.po                          0 /  31 (  0.0% translated)
- exceptions.po                    0 / 261 (  0.0% translated)
- file.po                          0 /  15 (  0.0% translated)
- float.po                        14 /  14 (100.0% translated)
- function.po                     18 /  18 (100.0% translated)
- gcsupport.po                     0 /  25 (  0.0% translated)
- gen.po                           8 /   8 (100.0% translated)
- import.po                        0 /  44 (  0.0% translated)
- index.po                         2 /   2 (100.0% translated)
- init.po                          0 / 287 (  0.0% translated)
- init_config.po                   0 / 274 (  0.0% translated)
- intro.po                         0 /  92 (  0.0% translated)
- iter.po                          5 /   5 (100.0% translated)
- iterator.po                      8 /   8 (100.0% translated)
- list.po                          0 /  23 (  0.0% translated)
- long.po                          0 /  52 (  0.0% translated)
- mapping.po                      15 /  15 (100.0% translated)
- marshal.po                      15 /  15 (100.0% translated)
- memory.po                        0 / 150 (  0.0% translated)
- memoryview.po                    8 /   9 ( 88.0% translated), 1 fuzzy
- method.po                       17 /  17 (100.0% translated)
- module.po                        0 /  87 (  0.0% translated)
- none.po                          4 /   4 (100.0% translated)
- number.po                        0 /  41 (  0.0% translated)
- objbuffer.po                     8 /   8 (100.0% translated)
- object.po                        0 /  77 (  0.0% translated)
- objimpl.po                       2 /   2 (100.0% translated)
- refcounting.po                  11 /  11 (100.0% translated)
- reflection.po                    8 /   8 (100.0% translated)
- sequence.po                      0 /  27 (  0.0% translated)
- set.po                           0 /  23 (  0.0% translated)
- slice.po                         0 /  20 (  0.0% translated)
- stable.po                        6 /   6 (100.0% translated)
- structures.po                    0 / 112 (  0.0% translated)
- sys.po                           0 /  69 (  0.0% translated)
- tuple.po                         0 /  48 (  0.0% translated)
- type.po                          0 /  52 (  0.0% translated)
- typeobj.po                       0 / 586 (  0.0% translated)
- unicode.po                       0 / 332 (  0.0% translated)
- utilities.po                     2 /   2 (100.0% translated)
- veryhigh.po                     61 /  61 (100.0% translated)
- weakref.po                      10 /  10 (100.0% translated)

(Yes it's a patched version of potodo that displays 100.0% translated lines also, to better see the issue)

It indicates ~47% is done, but visually I don't think so, so I checked and find 9%:

$ potodo --offline --path c-api/ | awk '{done += $3; all += $5} END {print 100 * done / all}'
9.4029

9% makes more sense when we count translated and untranslated entries:

$ msgcat c-api/*.po | msgattrib --translated | grep -c '^msgid'
343
(python-docs-es) mdk@seraph:~/clones/python/python-docs-es (3.8)
$ msgcat c-api/*.po | grep -c '^msgid'
3508

there's 343/3508 entries translated, roughly 10%, so the 9.4% looks right, the 47% looks wrong.

Oh, is it 47% of files done? Maybe not:

$ potodo --offline --path c-api/ | grep -c ^-
61
$ potodo --offline --path c-api/ | grep -c 100.0%
27
$ python3
>>> 100 * 27 / 61
44.26229508196721
@awecx
Copy link
Collaborator

awecx commented May 22, 2020

This actually show the mean of the percentages translated of the files as explained in this issue.
I agree this is not what a user would expect.

@awecx awecx self-assigned this Jun 4, 2020
@Seluj78 Seluj78 added this to the Version 1.0 🎉 milestone Aug 25, 2020
@Seluj78
Copy link
Collaborator

Seluj78 commented Oct 14, 2020

I just did some calculations on python-docs-fr/howto and it looks correct, So I don't see how there is a math error

# howto (78.82% done)

- clinic.po                      121 / 415 ( 29.0% translated)
- cporting.po                      1 /   5 ( 20.0% translated)
- instrumentation.po              58 /  59 ( 98.0% translated), 1 fuzzy
- logging-cookbook.po              9 / 216 (  4.0% translated)
- logging.po                     217 / 219 ( 99.0% translated), 1 fuzzy
- pyporting.po                    78 /  86 ( 90.0% translated), 7 fuzzy
- sorting.po                      52 /  54 ( 96.0% translated), 2 fuzzy
- urllib2.po                       4 /  85 (  4.0% translated)

There is 8 not done files

(venv) ➜  potodo git:(master) ls -l ~/Projects/python-docs-fr/howto/*.po | wc -l 
      17

And 17 files total which leaves 9 files finished

>>> (0.29 + 0.20 + 0.98 + 0.04 + 0.99 + 0.90 + 0.96 + 0.04 + 9) / 17
0.7882352941176469

Which is correct !

@JulienPalard
Copy link
Collaborator Author

I did the math too, we do not agree:

$ git rev-parse HEAD
8fcc6e17b048cb13b115364d598f17bf796f7adf

$ msgcat howto/*.po | msgattrib --translated | grep -c '^msgid'
1504

$ msgcat howto/*.po | grep -c '^msgid'
2092

$ python3
>>> 100 * 1504 / 2092
71.89292543021033

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants