| 111 | |
| 112 | |
| 113 | class EUCTWDistributionAnalysis(CharDistributionAnalysis): |
| 114 | def __init__(self): |
| 115 | super(EUCTWDistributionAnalysis, self).__init__() |
| 116 | self._char_to_freq_order = EUCTW_CHAR_TO_FREQ_ORDER |
| 117 | self._table_size = EUCTW_TABLE_SIZE |
| 118 | self.typical_distribution_ratio = EUCTW_TYPICAL_DISTRIBUTION_RATIO |
| 119 | |
| 120 | def get_order(self, byte_str): |
| 121 | # for euc-TW encoding, we are interested |
| 122 | # first byte range: 0xc4 -- 0xfe |
| 123 | # second byte range: 0xa1 -- 0xfe |
| 124 | # no validation needed here. State machine has done that |
| 125 | first_char = byte_str[0] |
| 126 | if first_char >= 0xC4: |
| 127 | return 94 * (first_char - 0xC4) + byte_str[1] - 0xA1 |
| 128 | else: |
| 129 | return -1 |
| 130 | |
| 131 | |
| 132 | class EUCKRDistributionAnalysis(CharDistributionAnalysis): |
no outgoing calls
no test coverage detected
searching dependent graphs…