katsuyoujin 0.0.1.1 → 0.0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/katsuyoujin.rb +13 -2
- data/lib/katsuyoujin/analyzer.rb +1 -1
- data/lib/katsuyoujin/base.rb +0 -3
- data/lib/katsuyoujin/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44cfd3f22767c75014b9a50f281789113f6f260a
|
4
|
+
data.tar.gz: 2bbf9e0d4c05170863d8d71a0db24860904071ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf84e89a694d05cc354a0f88583cbd3090e296ea13ae029f54694b0bb836ce6d7cfa67ad9666c5a2b9d00e7982346c3d2d621d8a7cb67db37a3703dcc8e18a61
|
7
|
+
data.tar.gz: 47592697ea54f010016b63f252d5e89fe312e446152dc8f6929faf98ff29d15032b77a7ac04315e64ddc0c0c3465ddc41b2e863824499c20410d261b2ed08e27
|
data/lib/katsuyoujin.rb
CHANGED
@@ -6,8 +6,19 @@ require 'katsuyoujin/base'
|
|
6
6
|
require 'katsuyoujin/analyzer'
|
7
7
|
|
8
8
|
module Katsuyoujin
|
9
|
-
|
10
|
-
|
9
|
+
def self.root
|
10
|
+
File.dirname __dir__
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.rules
|
14
|
+
File.join root, 'rules'
|
15
|
+
end
|
16
|
+
|
17
|
+
ICHIDAN_BASE_TABLE = YAML.load_file File.join(Katsuyoujin.rules, 'ichidan/base.yml').freeze
|
18
|
+
GODAN_BASE_TABLE = YAML.load_file File.join(Katsuyoujin.rules, 'godan/base.yml').freeze
|
19
|
+
|
20
|
+
CONJUGATIONS = { 'ichidan' => YAML.load_file(File.join(rules, 'ichidan/conjugations.yml')).freeze,
|
21
|
+
'godan' => YAML.load_file(File.join(rules, 'godan/conjugations.yml')).freeze }
|
11
22
|
|
12
23
|
def self.conjugate(word, *args, category: nil, hiragana: true)
|
13
24
|
verb = Verb.new word
|
data/lib/katsuyoujin/analyzer.rb
CHANGED
@@ -29,7 +29,7 @@ module Katsuyoujin
|
|
29
29
|
case
|
30
30
|
when ['する'].include?(base_form_hiragana.chars.last(2).join) then 'irregular'
|
31
31
|
when 'くる' == base_form_hiragana then 'irregular'
|
32
|
-
when YAML.load_file('
|
32
|
+
when YAML.load_file(File.join(Katsuyoujin.rules, 'godan/iru_eru.yml')).include?(base_form_hiragana) then 'godan'
|
33
33
|
when ['iru', 'eru'].include?(base_form_hiragana.romaji.chars.last(3).join) then 'ichidan'
|
34
34
|
else 'godan'
|
35
35
|
end
|
data/lib/katsuyoujin/base.rb
CHANGED
@@ -2,9 +2,6 @@ module Katsuyoujin
|
|
2
2
|
class Base
|
3
3
|
attr_reader :verb, :base_letter
|
4
4
|
|
5
|
-
ICHIDAN_BASE_TABLE = YAML.load_file 'rules/ichidan/base.yml'
|
6
|
-
GODAN_BASE_TABLE = YAML.load_file 'rules/godan/base.yml'
|
7
|
-
|
8
5
|
def initialize(verb, base_letter)
|
9
6
|
@verb = verb
|
10
7
|
@base_letter = base_letter
|
data/lib/katsuyoujin/version.rb
CHANGED