arabic_conjugator 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +27 -0
- data/LICENSE.txt +22 -0
- data/README.md +8 -0
- data/Rakefile +1 -0
- data/arabic_conjugator.gemspec +20 -0
- data/lib/arabic_conjugator.rb +43 -0
- data/lib/arabic_conjugator/base.rb +70 -0
- data/lib/arabic_conjugator/factories/base_factory.rb +74 -0
- data/lib/arabic_conjugator/factories/tense_factory.rb +20 -0
- data/lib/arabic_conjugator/factories/type_factory.rb +59 -0
- data/lib/arabic_conjugator/form.rb +10 -0
- data/lib/arabic_conjugator/form_II_hollow_defective.rb +6 -0
- data/lib/arabic_conjugator/form_I_defective.rb +5 -0
- data/lib/arabic_conjugator/form_I_defective_past.rb +12 -0
- data/lib/arabic_conjugator/form_I_defective_present.rb +9 -0
- data/lib/arabic_conjugator/form_I_hamzated_past.rb +16 -0
- data/lib/arabic_conjugator/form_I_hamzated_present.rb +16 -0
- data/lib/arabic_conjugator/form_I_hollow_past.rb +5 -0
- data/lib/arabic_conjugator/form_I_hollow_present.rb +6 -0
- data/lib/arabic_conjugator/form_VIII_hamzated.rb +5 -0
- data/lib/arabic_conjugator/form_VIII_hollow.rb +5 -0
- data/lib/arabic_conjugator/past_bases/form_III_past_base.rb +42 -0
- data/lib/arabic_conjugator/past_bases/form_II_past_base.rb +36 -0
- data/lib/arabic_conjugator/past_bases/form_IV_past_base.rb +46 -0
- data/lib/arabic_conjugator/past_bases/form_I_past_base.rb +57 -0
- data/lib/arabic_conjugator/past_bases/form_VIII_past_base.rb +78 -0
- data/lib/arabic_conjugator/past_bases/form_VII_past_base.rb +26 -0
- data/lib/arabic_conjugator/past_bases/form_VI_past_base.rb +32 -0
- data/lib/arabic_conjugator/past_bases/form_V_past_base.rb +35 -0
- data/lib/arabic_conjugator/past_bases/form_X_past_base.rb +40 -0
- data/lib/arabic_conjugator/past_tense.rb +12 -0
- data/lib/arabic_conjugator/present_bases/form_III_present_base.rb +30 -0
- data/lib/arabic_conjugator/present_bases/form_II_present_base.rb +34 -0
- data/lib/arabic_conjugator/present_bases/form_IV_present_base.rb +48 -0
- data/lib/arabic_conjugator/present_bases/form_I_present_base.rb +54 -0
- data/lib/arabic_conjugator/present_bases/form_VIII_present_base.rb +67 -0
- data/lib/arabic_conjugator/present_bases/form_VII_present_base.rb +31 -0
- data/lib/arabic_conjugator/present_bases/form_VI_present_base.rb +47 -0
- data/lib/arabic_conjugator/present_bases/form_V_present_base.rb +30 -0
- data/lib/arabic_conjugator/present_bases/form_X_present_base.rb +30 -0
- data/lib/arabic_conjugator/present_tense.rb +12 -0
- data/lib/arabic_conjugator/version.rb +3 -0
- data/spec/past_tense/formIII_past_spec.rb +75 -0
- data/spec/past_tense/formII_past_spec.rb +108 -0
- data/spec/past_tense/formIV_past_spec.rb +122 -0
- data/spec/past_tense/formI_past_spec.rb +160 -0
- data/spec/past_tense/formVIII_past_spec.rb +135 -0
- data/spec/past_tense/formVII_past_spec.rb +60 -0
- data/spec/past_tense/formVI_past_spec.rb +70 -0
- data/spec/past_tense/formV_past_spec.rb +77 -0
- data/spec/past_tense/formX_past_spec.rb +78 -0
- data/spec/present_tense/formIII_present_spec.rb +80 -0
- data/spec/present_tense/formII_present_spec.rb +102 -0
- data/spec/present_tense/formIV_present_spec.rb +107 -0
- data/spec/present_tense/formI_present_spec.rb +143 -0
- data/spec/present_tense/formVIII_present_spec.rb +126 -0
- data/spec/present_tense/formVII_present_spec.rb +50 -0
- data/spec/present_tense/formVI_present_spec.rb +75 -0
- data/spec/present_tense/formV_present_spec.rb +87 -0
- data/spec/present_tense/formX_present_spec.rb +68 -0
- data/spec/spec_helper.rb +5 -0
- metadata +166 -0
@@ -0,0 +1,16 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
FORM_I_HAMZATED_PRESENT = {
|
4
|
+
"بدء" => "أ",
|
5
|
+
"سءل" => "أ",
|
6
|
+
"رءس" => "أ",
|
7
|
+
"بءس" => "ئ",
|
8
|
+
"رءي" => "أ",
|
9
|
+
"قرء" => "أ",
|
10
|
+
"جرء" => "ؤ",
|
11
|
+
"جيء" => "ئ",
|
12
|
+
"لءم" => "أ",
|
13
|
+
"بطء" => "ؤ",
|
14
|
+
"برء" => "ئ",
|
15
|
+
"رءي" => ""
|
16
|
+
}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require_relative '../base'
|
4
|
+
|
5
|
+
class FormIIIPastBase < Base
|
6
|
+
|
7
|
+
def initialize(verb)
|
8
|
+
super
|
9
|
+
@base = calculate_base
|
10
|
+
end
|
11
|
+
|
12
|
+
def defective_base
|
13
|
+
if @root3 == "و" && @pronoun == :he
|
14
|
+
@base[0...-1] + "ا"
|
15
|
+
elsif @root3 == "ي" && @pronoun == :he
|
16
|
+
@base[0...-1] + "ى"
|
17
|
+
else
|
18
|
+
@base
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def adjust_first_radical
|
23
|
+
@root1 = "آ"
|
24
|
+
end
|
25
|
+
|
26
|
+
def adjust_second_radical
|
27
|
+
@root2 = "ء"
|
28
|
+
end
|
29
|
+
|
30
|
+
def adjust_third_radical
|
31
|
+
@root3 = "أ"
|
32
|
+
end
|
33
|
+
|
34
|
+
def calculate_base
|
35
|
+
if @root1 == "آ"
|
36
|
+
@root1 + @root2 + @root3
|
37
|
+
else
|
38
|
+
@root1 + "ا" + @root2 + @root3
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require_relative '../form_II_hollow_defective'
|
3
|
+
require_relative '../base'
|
4
|
+
|
5
|
+
class FormIIPastBase < Base
|
6
|
+
|
7
|
+
def initialize(verb)
|
8
|
+
super
|
9
|
+
@base = @root1 + @root2 + "ّ" + @root3
|
10
|
+
end
|
11
|
+
|
12
|
+
def doubled_base
|
13
|
+
@base
|
14
|
+
end
|
15
|
+
|
16
|
+
def hollow_defective_base
|
17
|
+
@base = @base[0...-1]
|
18
|
+
roots = @root1 + @root2 + @root3
|
19
|
+
if @pronoun == :he
|
20
|
+
@base + FORM_II_HOLLOW_DEFECTIVE[roots]
|
21
|
+
elsif [:she, :they].include?(@pronoun)
|
22
|
+
@base
|
23
|
+
else
|
24
|
+
@base + "ي"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def adjust_second_radical
|
29
|
+
@root2 = "أ"
|
30
|
+
end
|
31
|
+
|
32
|
+
def adjust_third_radical
|
33
|
+
@root3 = "أ"
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require_relative '../base'
|
4
|
+
|
5
|
+
class FormIVPastBase < Base
|
6
|
+
|
7
|
+
def initialize(verb)
|
8
|
+
super
|
9
|
+
@base = calculate_base
|
10
|
+
end
|
11
|
+
|
12
|
+
def hollow_base
|
13
|
+
if [:he, :she, :they].include?(@pronoun)
|
14
|
+
"أ" + @root1 + "ا" + @root3
|
15
|
+
else
|
16
|
+
"أ" + @root1 + @root3
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def calculate_base
|
21
|
+
if @root1 == "آ"
|
22
|
+
@root1 + @root2 + @root3
|
23
|
+
else
|
24
|
+
"أ" + @root1 + @root2 + @root3
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def adjust_first_radical
|
29
|
+
@root1 = "آ"
|
30
|
+
end
|
31
|
+
|
32
|
+
def adjust_second_radical
|
33
|
+
@root2 = "أ"
|
34
|
+
end
|
35
|
+
|
36
|
+
def adjust_third_radical
|
37
|
+
if [:he, :she].include?(@pronoun) && ["و", "ي"].include?(@root2)
|
38
|
+
@root3 = "ء"
|
39
|
+
elsif @pronoun == :they
|
40
|
+
@root3 = "ؤ"
|
41
|
+
else
|
42
|
+
@root3 = "أ"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require_relative '../form_I_hamzated_past'
|
3
|
+
require_relative '../form_I_defective_past'
|
4
|
+
require_relative '../form_I_hollow_past'
|
5
|
+
require_relative '../base'
|
6
|
+
|
7
|
+
class FormIPastBase < Base
|
8
|
+
|
9
|
+
def initialize(verb)
|
10
|
+
super
|
11
|
+
@base = @root1 + @root2 + @root3
|
12
|
+
end
|
13
|
+
|
14
|
+
def hollow_base
|
15
|
+
if [:he, :she, :they].include?(@pronoun)
|
16
|
+
if @root3 == "ئ"
|
17
|
+
@root1 + "اء"
|
18
|
+
else
|
19
|
+
@root1 + (FORM_I_HOLLOW_PAST[@base] ||= "ا") + @root3
|
20
|
+
end
|
21
|
+
else
|
22
|
+
@root1 + @root3
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def defective_base
|
27
|
+
base = @base[0...-1]
|
28
|
+
if @pronoun == :he
|
29
|
+
return base + FORM_I_DEFECTIVE_PAST[@base] if FORM_I_DEFECTIVE_PAST[@base]
|
30
|
+
return base + "ا" if @root3 == "و"
|
31
|
+
return base + "ى"
|
32
|
+
elsif [:I, :you_m, :you_f, :you_pl].include?(@pronoun)
|
33
|
+
@base
|
34
|
+
else
|
35
|
+
base
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def doubled_base
|
40
|
+
if [:he, :she, :they].include?(@pronoun)
|
41
|
+
@base[0...-1] + "ّ"
|
42
|
+
else
|
43
|
+
@base
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def adjust_second_radical
|
48
|
+
base = @root1 + @root2 + @root3
|
49
|
+
@root2 = FORM_I_HAMZATED_PAST[base]
|
50
|
+
end
|
51
|
+
|
52
|
+
def adjust_third_radical
|
53
|
+
base = @root1 + @root2 + @root3
|
54
|
+
@root3 = FORM_I_HAMZATED_PAST[base]
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require_relative '../base'
|
4
|
+
require_relative '../form_VIII_hamzated'
|
5
|
+
require_relative '../form_VIII_hollow'
|
6
|
+
|
7
|
+
|
8
|
+
class FormVIIIPastBase < Base
|
9
|
+
|
10
|
+
def initialize(verb)
|
11
|
+
super
|
12
|
+
@base = "ا" + @root1 + "ت" + @root2 + @root3
|
13
|
+
end
|
14
|
+
|
15
|
+
def regular_base
|
16
|
+
if @root1 == "ت"
|
17
|
+
"اتّ" + @root2 + @root3
|
18
|
+
else
|
19
|
+
@base
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def hollow_base
|
24
|
+
@root2 = (FORM_VIII_HOLLOW[@root1+@root2+@root3] ||= "ا")
|
25
|
+
@base = "ا" + @root1 + "ت" + @root2 + @root3
|
26
|
+
@base = morphed_taa_base if ["ز", "ذ", "ص", "ض"].include?(@root1)
|
27
|
+
if @root2 == "ا" && ![:he, :she, :they].include?(@pronoun)
|
28
|
+
@base[0..2] + @root3
|
29
|
+
else
|
30
|
+
@base
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def doubled_base
|
35
|
+
@base = morphed_taa_base if ["ز", "ذ", "ص", "ض"].include?(@root1)
|
36
|
+
super
|
37
|
+
end
|
38
|
+
|
39
|
+
def assimilated_defective_base
|
40
|
+
@base = "اتّ" + @root2
|
41
|
+
if @pronoun == :he
|
42
|
+
@base + "ى"
|
43
|
+
elsif [:she, :they].include?(@pronoun)
|
44
|
+
@base
|
45
|
+
else
|
46
|
+
@base + "ي"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def assimilated_base
|
51
|
+
"اتّ" + @root2 + @root3
|
52
|
+
end
|
53
|
+
|
54
|
+
def assimilated_taa_base
|
55
|
+
"ا" + @root1 + "ّ" + @root2 + @root3
|
56
|
+
end
|
57
|
+
|
58
|
+
def morphed_taa_base
|
59
|
+
if ["ز", "ذ"].include?(@root1)
|
60
|
+
"ا" + @root1 + "د" + @root2 + @root3
|
61
|
+
else
|
62
|
+
"ا" + @root1 + "ط" + @root2 + @root3
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def adjust_first_radical
|
67
|
+
@root1 = (FORM_VIII_HAMZATED[@root1 + @root2 + @root3] ||= "ئ")
|
68
|
+
end
|
69
|
+
|
70
|
+
def adjust_second_radical
|
71
|
+
@root2 = "أ"
|
72
|
+
end
|
73
|
+
|
74
|
+
def adjust_third_radical
|
75
|
+
@root3 = "أ"
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require_relative '../base'
|
4
|
+
|
5
|
+
class FormVIIPastBase < Base
|
6
|
+
|
7
|
+
def initialize(verb)
|
8
|
+
super
|
9
|
+
@base = "ان" + @root1 + @root2 + @root3
|
10
|
+
end
|
11
|
+
|
12
|
+
def hollow_base
|
13
|
+
@root2 = "ا"
|
14
|
+
@base = "ان" + @root1 + @root2 + @root3
|
15
|
+
if [:he, :she, :they].include?(@pronoun)
|
16
|
+
@base
|
17
|
+
else
|
18
|
+
"ان" + @root1 + @root3
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def adjust_third_radical
|
23
|
+
@root3 = "أ"
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require_relative '../base'
|
4
|
+
|
5
|
+
class FormVIPastBase < Base
|
6
|
+
|
7
|
+
def initialize(verb)
|
8
|
+
super
|
9
|
+
@base = calculate_base
|
10
|
+
end
|
11
|
+
|
12
|
+
def adjust_first_radical
|
13
|
+
@root1 = "آ"
|
14
|
+
end
|
15
|
+
|
16
|
+
def adjust_second_radical
|
17
|
+
@root2 = "ء"
|
18
|
+
end
|
19
|
+
|
20
|
+
def adjust_third_radical
|
21
|
+
@root3 = "أ"
|
22
|
+
end
|
23
|
+
|
24
|
+
def calculate_base
|
25
|
+
if @root1 == "آ"
|
26
|
+
"ت" + @root1 + @root2 + @root3
|
27
|
+
else
|
28
|
+
"ت" + @root1 + "ا" + @root2 + @root3
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require_relative '../base'
|
4
|
+
|
5
|
+
class FormVPastBase < Base
|
6
|
+
|
7
|
+
def initialize(verb)
|
8
|
+
super
|
9
|
+
@base = "ت" + @root1 + @root2 + "ّ" + @root3
|
10
|
+
end
|
11
|
+
|
12
|
+
def defective_base
|
13
|
+
if @pronoun == :he
|
14
|
+
return @base[0...-1] + "ا" if @root3 == "و"
|
15
|
+
@base[0...-1] + "ى"
|
16
|
+
elsif [:she, :they].include?(@pronoun)
|
17
|
+
@base[0...-1]
|
18
|
+
else
|
19
|
+
@base
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def doubled_base
|
24
|
+
@base
|
25
|
+
end
|
26
|
+
|
27
|
+
def adjust_second_radical
|
28
|
+
@root2 = "أ"
|
29
|
+
end
|
30
|
+
|
31
|
+
def adjust_third_radical
|
32
|
+
@root3 = "أ"
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require_relative '../base'
|
4
|
+
|
5
|
+
class FormXPastBase < Base
|
6
|
+
|
7
|
+
def initialize(verb)
|
8
|
+
super
|
9
|
+
@base = "است" + @root1 + @root2 + @root3
|
10
|
+
end
|
11
|
+
|
12
|
+
def hollow_base
|
13
|
+
@root2 = "ا"
|
14
|
+
if [:he, :she, :they].include?(@pronoun)
|
15
|
+
@base
|
16
|
+
else
|
17
|
+
"است" + @root1 + @root3
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def hollow_defective_base
|
22
|
+
@base = @base[0...-1]
|
23
|
+
if @pronoun == :he
|
24
|
+
@base + "ا"
|
25
|
+
elsif [:she, :they].include?(@pronoun)
|
26
|
+
@base
|
27
|
+
else
|
28
|
+
@base + "ي"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def adjust_second_radical
|
33
|
+
@root2 = "أ"
|
34
|
+
end
|
35
|
+
|
36
|
+
def adjust_third_radical
|
37
|
+
@root3 = "أ"
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|