class CharDet::EUCJPContextAnalysis

Public Instance Methods

get_order(aStr) click to toggle source
# 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