module Indofix

Constants

VERSION

Public Class Methods

check(params, string) click to toggle source

Let's start check

options:

  • nomina

  • verba

  • other

  • kpst

# File lib/indofix.rb, line 42
def check(params, string)
  @result = {}
  if (!params.empty? && !string.empty?)
    case params
      when 'nomina'
        @result = nomina_probe(string)
      when 'verba'
        @result = verba_probe(string)
      when 'other'
        @result = other_probe(string)
      when 'kpst'
        @result = kpst_probe(string)
    end
    @result.keys
  else
    raise(error, "Params and String cannot Empty")
  end
end
check_kpst() click to toggle source
# File lib/indofix.rb, line 23
def check_kpst
  @check_kpst ||= IndofixKpstHelper.new
end
check_nomina() click to toggle source
# File lib/indofix.rb, line 15
def check_nomina
  @check_nomina ||= IndofixNominaHelper.new
end
check_other() click to toggle source
# File lib/indofix.rb, line 27
def check_other
  @check_other ||= IndofixOtherHelper.new
end
check_verba() click to toggle source
# File lib/indofix.rb, line 19
def check_verba
  @check_verba ||= IndofixVerbaHelper.new
end
error() click to toggle source
# File lib/indofix.rb, line 31
def error
  @error ||= Error.new
end
kpst_probe(string) click to toggle source

Check probability for KPST Return Hash

# File lib/indofix.rb, line 94
def kpst_probe(string)
  kpst = check_kpst.methods.grep(/imbuhan/)
  @detected = Hash.new
  kpst.each do |method|
    transform = check_kpst.send(method, string)
    @detected[transform[1]] = method.to_s unless transform.nil?
  end
  return @detected
end
nomina_probe(string) click to toggle source

Check probability for Nomina Return Hash

# File lib/indofix.rb, line 82
def nomina_probe(string)
  nomina = check_nomina.methods.grep(/nomina/)
  @detected = Hash.new
  nomina.each do |method|
    transform = check_nomina.send(method, string)
    @detected[transform[1]] = method.to_s unless transform.nil?
  end
  return @detected
end
other_probe(string) click to toggle source

Check probability for Others Return Hash

# File lib/indofix.rb, line 118
def other_probe(string)
  other = check_other.methods.grep(/other/)
  @detected = Hash.new
  other.each do |method|
    transform = check_other.send(method, string)
    @detected[transform[1]] = method.to_s unless transform.nil?
  end
  return @detected
end
stupid_check(string) click to toggle source

Let's check all possibilities at once

Params String Return Hash

# File lib/indofix.rb, line 65
def stupid_check(string)
  @result = {}
  if !string.empty?
    @nomina = nomina_probe(string)
    @verba = verba_probe(string)
    @other = other_probe(string)
    @kpst = kpst_probe(string)
    hashes = [@nomina, @verba, @other, @kpst]

    @result = Hash[*hashes.map(&:to_a).flatten]
  else
    raise(error, "String cannot empty/nil")
  end
end
verba_probe(string) click to toggle source

Check probability for Verba Return Hash

# File lib/indofix.rb, line 106
def verba_probe(string)
  verba = check_verba.methods.grep(/verba/)
  @detected = Hash.new
  verba.each do |method|
    transform = check_verba.send(method, string)
    @detected[transform[1]] = method.to_s unless transform.nil?
  end
  return @detected
end
welcome() click to toggle source
# File lib/indofix.rb, line 11
def welcome
  "Welcome to Indofix"
end