Class: CharDet::EUCJPContextAnalysis
- Inherits:
-
JapaneseContextAnalysis
- Object
- JapaneseContextAnalysis
- CharDet::EUCJPContextAnalysis
- Defined in:
- lib/rchardet/jpcntx.rb
Instance Method Summary collapse
Methods inherited from JapaneseContextAnalysis
#feed, #get_confidence, #got_enough_data, #initialize, #reset
Constructor Details
This class inherits a constructor from CharDet::JapaneseContextAnalysis
Instance Method Details
#get_order(aStr) ⇒ Object
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
# File 'lib/rchardet/jpcntx.rb', line 206 def get_order(aStr) return -1, 1 unless aStr # find out current char's byte length first = aStr[0, 1] if (first == "\x8E") or ((first >= "\xA1") and (first <= "\xFE")) charLen = 2 elsif first == "\x8F" charLen = 3 else charLen = 1 end # return its order if it is hiragana if aStr.length > 1 second = aStr[1, 1] if (first == "\xA4") and (second >= "\xA1") and (second <= "\xF3") return aStr[1].ord - 0xA1, charLen end end return -1, charLen end |