OLD | NEW |
1 ######################## BEGIN LICENSE BLOCK ######################## | 1 ######################## BEGIN LICENSE BLOCK ######################## |
2 # The Original Code is Mozilla Universal charset detector code. | 2 # The Original Code is Mozilla Universal charset detector code. |
3 # | 3 # |
4 # The Initial Developer of the Original Code is | 4 # The Initial Developer of the Original Code is |
5 # Netscape Communications Corporation. | 5 # Netscape Communications Corporation. |
6 # Portions created by the Initial Developer are Copyright (C) 2001 | 6 # Portions created by the Initial Developer are Copyright (C) 2001 |
7 # the Initial Developer. All Rights Reserved. | 7 # the Initial Developer. All Rights Reserved. |
8 # | 8 # |
9 # Contributor(s): | 9 # Contributor(s): |
10 # Mark Pilgrim - port to Python | 10 # Mark Pilgrim - port to Python |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 confidence = 0.0 | 130 confidence = 0.0 |
131 else: | 131 else: |
132 confidence = ((self._mFreqCounter[3] / total) | 132 confidence = ((self._mFreqCounter[3] / total) |
133 - (self._mFreqCounter[1] * 20.0 / total)) | 133 - (self._mFreqCounter[1] * 20.0 / total)) |
134 if confidence < 0.0: | 134 if confidence < 0.0: |
135 confidence = 0.0 | 135 confidence = 0.0 |
136 # lower the confidence of latin1 so that other more accurate | 136 # lower the confidence of latin1 so that other more accurate |
137 # detector can take priority. | 137 # detector can take priority. |
138 confidence = confidence * 0.5 | 138 confidence = confidence * 0.5 |
139 return confidence | 139 return confidence |
OLD | NEW |