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.4.0"
Class Method Summary collapse
-
.check(params, string) ⇒ Object
Let’s start check.
- .check_kpst ⇒ Object
- .check_nomina ⇒ Object
- .check_other ⇒ Object
- .check_verba ⇒ Object
- .error ⇒ Object
-
.kpst_probe(string) ⇒ Object
Check probability for KPST Return Hash.
-
.nomina_probe(string) ⇒ Object
Check probability for Nomina Return Hash.
-
.other_probe(string) ⇒ Object
Check probability for Others Return Hash.
-
.stupid_check(string) ⇒ Object
Let’s check all possibilities at once.
-
.verba_probe(string) ⇒ Object
Check probability for Verba Return Hash.
- .welcome ⇒ Object
Class Method Details
.check(params, string) ⇒ Object
Let’s start check
options:
-
nomina
-
verba
-
other
-
kpst
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# 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 ⇒ Object
23 24 25 |
# File 'lib/indofix.rb', line 23 def check_kpst @check_kpst ||= IndofixKpstHelper.new end |
.check_nomina ⇒ Object
15 16 17 |
# File 'lib/indofix.rb', line 15 def check_nomina @check_nomina ||= IndofixNominaHelper.new end |
.check_other ⇒ Object
27 28 29 |
# File 'lib/indofix.rb', line 27 def check_other @check_other ||= IndofixOtherHelper.new end |
.check_verba ⇒ Object
19 20 21 |
# File 'lib/indofix.rb', line 19 def check_verba @check_verba ||= IndofixVerbaHelper.new end |
.error ⇒ Object
31 32 33 |
# File 'lib/indofix.rb', line 31 def error @error ||= Error.new end |
.kpst_probe(string) ⇒ Object
Check probability for KPST Return Hash
94 95 96 97 98 99 100 101 102 |
# 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) ⇒ Object
Check probability for Nomina Return Hash
82 83 84 85 86 87 88 89 90 |
# 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) ⇒ Object
Check probability for Others Return Hash
118 119 120 121 122 123 124 125 126 |
# 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) ⇒ Object
Let’s check all possibilities at once
Params String Return Hash
65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# 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) ⇒ Object
Check probability for Verba Return Hash
106 107 108 109 110 111 112 113 114 |
# 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 ⇒ Object
11 12 13 |
# File 'lib/indofix.rb', line 11 def welcome "Welcome to Indofix" end |