conjugate 1.4.3 → 1.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/conjugate.gemspec +1 -1
- data/lib/conjugate/common.rb +13 -1
- data/lib/conjugate/french.rb +19 -1
- data/lib/conjugate/french_templates/templates.rb +607 -289
- data/lib/conjugate/spanish.rb +1 -0
- data/lib/conjugate.rb +1 -0
- metadata +2 -1
data/conjugate.gemspec
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = 'conjugate'
|
|
3
|
-
s.version = '1.4.
|
|
3
|
+
s.version = '1.4.4'
|
|
4
4
|
s.date = '2012-02-15'
|
|
5
5
|
s.summary = "Conjugate Verbs using a version of the templates defined here http://en.wiktionary.org/wiki/Category:Spanish_verb_inflection-table_templates"
|
|
6
6
|
s.description = s.summary
|
data/lib/conjugate/common.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
1
2
|
module Common
|
|
2
3
|
|
|
3
4
|
@@dividing_infinitive_regex = /\{{3}\d+\}{3}(\w+)/
|
|
@@ -20,7 +21,14 @@ module Common
|
|
|
20
21
|
|
|
21
22
|
return nil if template[tense].nil? || template[tense][opts[:pronoun].to_sym].nil?
|
|
22
23
|
|
|
23
|
-
conjugation_template =
|
|
24
|
+
conjugation_template = nil
|
|
25
|
+
|
|
26
|
+
if defined? conjugation_template_finder
|
|
27
|
+
debug('s')
|
|
28
|
+
conjugation_template = conjugation_template_finder(template, tense, opts).dup
|
|
29
|
+
else
|
|
30
|
+
conjugation_template = template[tense][opts[:pronoun].to_sym].dup
|
|
31
|
+
end
|
|
24
32
|
debug(conjugation_template)
|
|
25
33
|
|
|
26
34
|
positions = conjugation_template.scan(/\{{3}(\d+)\}{3}/).flatten
|
|
@@ -36,6 +44,10 @@ module Common
|
|
|
36
44
|
conjugation_template
|
|
37
45
|
end
|
|
38
46
|
|
|
47
|
+
# def conjugation_template_finder(template, tense, opts)
|
|
48
|
+
#
|
|
49
|
+
# end
|
|
50
|
+
|
|
39
51
|
def regular_ending(verb)
|
|
40
52
|
verb[-2..-1]
|
|
41
53
|
end
|
data/lib/conjugate/french.rb
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
1
2
|
require 'conjugate/french_templates/templates'
|
|
2
3
|
require 'conjugate/french_templates/irregular_verbs'
|
|
3
4
|
require 'conjugate/common'
|
|
4
5
|
|
|
5
6
|
module Conjugate
|
|
6
7
|
module French
|
|
7
|
-
extend self
|
|
8
8
|
extend Common
|
|
9
|
+
extend self
|
|
9
10
|
|
|
10
11
|
def generate_list_of_know_irregular_verbs
|
|
11
12
|
puts "- " + FrenchIrregularVerbs.keys.sort.join("\n- ")
|
|
@@ -19,5 +20,22 @@ module Conjugate
|
|
|
19
20
|
FrenchTemplates[(opts[:template] || find_irregular(opts[:verb]) || regular_ending(opts[:verb])).to_sym]
|
|
20
21
|
end
|
|
21
22
|
|
|
23
|
+
def conjugation_template_finder(template, tense, opts)
|
|
24
|
+
debug('here')
|
|
25
|
+
if opts[:tense] == 'passé composé' || opts[:tense] == 'passe compose'
|
|
26
|
+
if is_etre_verb(opts[:verb])
|
|
27
|
+
FrenchTemplates[:être][:present][opts[:pronoun]] + ' ' + template[:past_particitple]
|
|
28
|
+
else
|
|
29
|
+
FrenchTemplates[:avoir][:present][opts[:pronoun]] + ' ' + template[:past_particitple]
|
|
30
|
+
end
|
|
31
|
+
else
|
|
32
|
+
template[tense][opts[:pronoun].to_sym]
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def is_etre_verb(verb)
|
|
37
|
+
['monter', 'rester', 'sortir', 'venir', 'aller', 'naître', 'descendre', 'entrer', 'retourner', 'tomber', 'renter', 'arriver', 'mourir', 'partir', 'passer', 'décéder'].include? verb.downcase
|
|
38
|
+
end
|
|
39
|
+
|
|
22
40
|
end
|
|
23
41
|
end
|