From cf513c99329cb0e129f335c84a5d18a7a667978b Mon Sep 17 00:00:00 2001 From: Doug Cook Date: Mon, 10 Sep 2012 15:31:43 -0400 Subject: [PATCH] Fix an integer arithmetic bug, and improve the confidence multiplier. --- chardet/latin1prober.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chardet/latin1prober.py b/chardet/latin1prober.py index abaaf98..c8bc405 100755 --- a/chardet/latin1prober.py +++ b/chardet/latin1prober.py @@ -130,10 +130,10 @@ def get_confidence(self): if total < 0.01: confidence = 0.0 else: - confidence = (self._mFreqCounter[3] / total) - (self._mFreqCounter[1] * 20.0 / total) + confidence = (self._mFreqCounter[3] - self._mFreqCounter[1] * 20.0) / total if confidence < 0.0: confidence = 0.0 # lower the confidence of latin1 so that other more accurate detector # can take priority. - confidence = confidence * 0.5 + confidence = confidence * 0.73 return confidence