Class: CharDet::SJISContextAnalysis
- Inherits:
-
JapaneseContextAnalysis
- Object
- JapaneseContextAnalysis
- CharDet::SJISContextAnalysis
- Defined in:
- lib/rchardet/jpcntx.rb
Instance Method Summary collapse
Methods inherited from JapaneseContextAnalysis
#confidence, #feed, #got_enough_data, #initialize, #reset
Constructor Details
This class inherits a constructor from CharDet::JapaneseContextAnalysis
Instance Method Details
#order(aStr) ⇒ Object
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
# File 'lib/rchardet/jpcntx.rb', line 186 def order(aStr) return -1, 1 if not aStr # find out current char's byte length aStr = aStr[0..1].join if aStr.class == Array if ((aStr[0] >= "\x81") and (aStr[0] <= "\x9F")) or ((aStr[0] >= "\xE0") and (aStr[0] <= "\xFC")) charLen = 2 else charLen = 1 end # return its order if it is hiragana if aStr.length > 1 if (aStr[0] == "\202") and (aStr[1] >= "\x9F") and (aStr[1] <= "\xF1") return aStr[1].ord - 0x9F, charLen end end return -1, charLen end |