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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 111 |
112 def get_confidence(self): | 112 def get_confidence(self): |
113 r = 0.01 | 113 r = 0.01 |
114 if self._mTotalSeqs > 0: | 114 if self._mTotalSeqs > 0: |
115 r = ((1.0 * self._mSeqCounters[POSITIVE_CAT]) / self._mTotalSeqs | 115 r = ((1.0 * self._mSeqCounters[POSITIVE_CAT]) / self._mTotalSeqs |
116 / self._mModel['mTypicalPositiveRatio']) | 116 / self._mModel['mTypicalPositiveRatio']) |
117 r = r * self._mFreqChar / self._mTotalChar | 117 r = r * self._mFreqChar / self._mTotalChar |
118 if r >= 1.0: | 118 if r >= 1.0: |
119 r = 0.99 | 119 r = 0.99 |
120 return r | 120 return r |
OLD | NEW |