Class: CharDet::EUCJPDistributionAnalysis
- Inherits:
-
CharDistributionAnalysis
- Object
- CharDistributionAnalysis
- CharDet::EUCJPDistributionAnalysis
- Defined in:
- lib/rchardet/chardistribution.rb
Instance Method Summary collapse
-
#initialize ⇒ EUCJPDistributionAnalysis
constructor
A new instance of EUCJPDistributionAnalysis.
- #order(aStr) ⇒ Object
Methods inherited from CharDistributionAnalysis
#confidence, #feed, #got_enough_data, #reset
Constructor Details
#initialize ⇒ EUCJPDistributionAnalysis
Returns a new instance of EUCJPDistributionAnalysis.
218 219 220 221 222 223 |
# File 'lib/rchardet/chardistribution.rb', line 218 def initialize super() @_mCharToFreqOrder = JISCharToFreqOrder @_mTableSize = JIS_TABLE_SIZE @_mTypicalDistributionRatio = JIS_TYPICAL_DISTRIBUTION_RATIO end |
Instance Method Details
#order(aStr) ⇒ Object
225 226 227 228 229 230 231 232 233 234 235 |
# File 'lib/rchardet/chardistribution.rb', line 225 def order(aStr) # for euc-JP encoding, we are interested # first byte range: 0xa0 -- 0xfe # second byte range: 0xa1 -- 0xfe # no validation needed here. State machine has done that if aStr[0..0] >= "\xA0" return 94 * (aStr[0].ord - 0xA1) + aStr[1].ord - 0xa1 else return -1 end end |