Module: Indofix

Defined in:
lib/indofix.rb,
lib/indofix/errors.rb,
lib/indofix/version.rb,
lib/indofix/indofix_kpst_helper.rb,
lib/indofix/indofix_other_helper.rb,
lib/indofix/indofix_verba_helper.rb,
lib/indofix/indofix_nomina_helper.rb

Defined Under Namespace

Classes: Error, IndofixKpstHelper, IndofixNominaHelper, IndofixOtherHelper, IndofixVerbaHelper

Constant Summary collapse

VERSION =
"0.3.0"

Class Method Summary collapse

Class Method Details

.check(params, string) ⇒ Object

Let’s start check options:

  • nomina

  • verba

  • other

  • kpst



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/indofix.rb', line 36

def check(params, string)
  @result = {}
  if (!params.nil? || !string.nil?)
    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, "Indofix Error")
  end
end

.check_kpstObject



22
23
24
# File 'lib/indofix.rb', line 22

def check_kpst
  @check_kpst ||= IndofixKpstHelper.new
end

.check_nominaObject



14
15
16
# File 'lib/indofix.rb', line 14

def check_nomina
  @check_nomina ||= IndofixNominaHelper.new
end

.check_otherObject



26
27
28
# File 'lib/indofix.rb', line 26

def check_other
  @check_other ||= IndofixOtherHelper.new
end

.check_verbaObject



18
19
20
# File 'lib/indofix.rb', line 18

def check_verba
  @check_verba ||= IndofixVerbaHelper.new
end

.kpst_probe(string) ⇒ Object

Check probability for KPST Return Hash



69
70
71
72
73
74
75
76
77
# File 'lib/indofix.rb', line 69

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] = method.to_s unless transform.nil?
  end
  return @detected
end

.nomina_probe(string) ⇒ Object

Check probability for Nomina Return Hash



57
58
59
60
61
62
63
64
65
# File 'lib/indofix.rb', line 57

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) ⇒ Object

Check probability for Others Return Hash



93
94
95
96
97
98
99
100
101
# File 'lib/indofix.rb', line 93

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

.verba_probe(string) ⇒ Object

Check probability for Verba Return Hash



81
82
83
84
85
86
87
88
89
# File 'lib/indofix.rb', line 81

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] = method.to_s unless transform.nil?
  end
  return @detected
end

.welcomeObject



10
11
12
# File 'lib/indofix.rb', line 10

def welcome
  "Welcome to Indofix"
end