mikemccand / chromium-compact-language-detector

Automatically exported from code.google.com/p/chromium-compact-language-detector
160 stars 31 forks source link

Wasted work in cld::GetNormalizedScore() and cld::GetReliability() #16

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The problem appears in revision 215539. I have attached a simple one-line patch 
that fixes it.

In method cld::GetNormalizedScore() in cld/compact_lang_det/cldutil.cc, the 
loop in line 818 keeps overriding "expected_score" with "kMeanScore[cur_lang * 
4 + i]" when it is larger than zero. Therefore, only the last written value is 
visible out of the loop and all the other writes and iterations are not 
necessary. The patch iterates from the end of "i" and breaks the first time 
when "expected_score" is set.

Similar problem also appears in cld::GetReliability(), at line 846.

Original issue reported on code.google.com by pochang0...@gmail.com on 6 Aug 2013 at 8:34

Attachments:

GoogleCodeExporter commented 9 years ago
https://codereview.chromium.org/22321003/

Original comment by pochang0...@gmail.com on 6 Aug 2013 at 8:39

GoogleCodeExporter commented 9 years ago
Hi, can you open an issue on the cld2 project instead?  This project is now 
just the Python bindings around CLD2.

https://code.google.com/p/cld2/

Original comment by luc...@mikemccandless.com on 6 Aug 2013 at 8:42

GoogleCodeExporter commented 9 years ago
Thanks, reopen on the cld2 project.
https://code.google.com/p/cld2/issues/detail?id=2

Original comment by pochang0...@gmail.com on 6 Aug 2013 at 8:46

GoogleCodeExporter commented 9 years ago

Original comment by luc...@mikemccandless.com on 12 Sep 2013 at 6:42