class CharDet::EUCTWDistributionAnalysis
Public Class Methods
Source
# File lib/rchardet/chardistribution.rb, line 101 def initialize super() @charToFreqOrder = EUCTWCharToFreqOrder @tableSize = EUCTW_TABLE_SIZE @typicalDistributionRatio = EUCTW_TYPICAL_DISTRIBUTION_RATIO end
Calls superclass method
CharDet::CharDistributionAnalysis::new
Public Instance Methods
Source
# File lib/rchardet/chardistribution.rb, line 121 def get_confidence if @freqChars <= MINIMUM_DATA_THRESHOLD return SURE_NO end super end
Calls superclass method
CharDet::CharDistributionAnalysis#get_confidence
Source
# File lib/rchardet/chardistribution.rb, line 108 def get_order(aStr) # for euc-TW encoding, we are interested # first byte range: 0xc4 -- 0xfe # second byte range: 0xa1 -- 0xfe # no validation needed here. State machine has done that if aStr[0, 1] >= "\xC4" bytes = aStr.bytes.to_a return 94 * (bytes[0] - 0xC4) + bytes[1] - 0xA1 else return -1 end end