class CharDet::SJISContextAnalysis

Public Instance Methods

get_order(aStr) click to toggle source
# File lib/rchardet/jpcntx.rb, line 184
def get_order(aStr)
  return -1, 1 if aStr.nil? || aStr.empty?
  # find out current char's byte length
  first = aStr[0, 1]
  if ((first >= "\x81") and (first <= "\x9F")) or ((first >= "\xE0") and (first <= "\xFC"))
    charLen = 2
  else
    charLen = 1
  end
  # return its order if it is hiragana
  if aStr.length > 1
    second = aStr[1, 1]
    if (first == "\202") and (second >= "\x9F") and (second <= "\xF1")
      return aStr[1].ord - 0x9F, charLen
    end
  end

  return -1, charLen
end