verbs 2.2.1 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -5
- data/.gitignore +2 -0
- data/README.rdoc +5 -0
- data/lib/verbs/conjugator.rb +41 -19
- data/lib/verbs/version.rb +1 -1
- data/test/test_verbs.rb +38 -0
- metadata +3 -4
- data/VERSION +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39ca9a05484aea9907d487a1fd2d6c51bbe969040ae748411640076ae9cb4b50
|
4
|
+
data.tar.gz: fd81415cc5cad33a4ae06c1e7b45d26edb64bfc94acbf2fc2c0e29f576a228c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81bc1a48d71745e5443985abc0a7bb14c9e5548820eb1fa8c6455d81a14baa2928009a07a00e4d6561fac7afdfa3ba313b1e610a8af14e949c505fa6ec7f27cf
|
7
|
+
data.tar.gz: c16c9318396e3edf0f9b13c78f8c9e84e35bed61bc9fd05714e9009022e2df79c59b1d5057cbeafd22a8bda172c9292d15a35773e2b281f0753cc68c6552f66f
|
data/.github/workflows/ruby.yml
CHANGED
@@ -15,16 +15,12 @@ on:
|
|
15
15
|
|
16
16
|
jobs:
|
17
17
|
test:
|
18
|
-
|
19
18
|
runs-on: ubuntu-latest
|
20
19
|
|
21
20
|
steps:
|
22
21
|
- uses: actions/checkout@v2
|
23
22
|
- name: Set up Ruby
|
24
|
-
|
25
|
-
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
26
|
-
# uses: ruby/setup-ruby@v1
|
27
|
-
uses: ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0
|
23
|
+
uses: ruby/setup-ruby@v1
|
28
24
|
with:
|
29
25
|
ruby-version: 2.6
|
30
26
|
- name: Install dependencies
|
data/.gitignore
CHANGED
data/README.rdoc
CHANGED
@@ -43,6 +43,10 @@ One of <tt>:indicative</tt>, <tt>:imperative</tt>, or <tt>:subjunctive</tt>. Def
|
|
43
43
|
|
44
44
|
Set this to a string to prepend the conjugated verb with it. When set to <tt>true</tt>, a standard personal pronoun will be used.
|
45
45
|
|
46
|
+
=== <tt>:diathesis</tt>
|
47
|
+
|
48
|
+
One of <tt>:active</tt> or <tt>:passive</tt>. Defaults to <tt>:active</tt>.
|
49
|
+
|
46
50
|
== Tense/aspect quick reference
|
47
51
|
|
48
52
|
EXAMPLE TENSE ASPECT
|
@@ -71,6 +75,7 @@ Set this to a string to prepend the conjugated verb with it. When set to <tt>tru
|
|
71
75
|
* {Pat Byrd and Tom McKlin}[http://www2.gsu.edu/~wwwesl/egw/pluralsv.htm]
|
72
76
|
* {Rick Harrison}[http://www.rickharrison.com/language/aspect.html]
|
73
77
|
* {Anatoli Makarevich}[https://github.com/makaroni4] for {#6}[https://github.com/rossmeissl/verbs/pull/6]
|
78
|
+
* {Nikita Kamaev}[https://github.com/nerixim] for {#35}[https://github.com/rossmeissl/verbs/pull/35]
|
74
79
|
|
75
80
|
== Copyright
|
76
81
|
|
data/lib/verbs/conjugator.rb
CHANGED
@@ -79,8 +79,8 @@ module Verbs
|
|
79
79
|
mood = options[:mood] || :indicative # imperative, subjunctive
|
80
80
|
aspect = options[:aspect] || :habitual # perfective, habitual, progressive, perfect, prospective
|
81
81
|
|
82
|
-
check_for_improper_constructions(tense, person, mood)
|
83
|
-
form = form_for(tense, aspect)
|
82
|
+
check_for_improper_constructions(infinitive, tense, person, mood, diathesis) # find incompatabilities
|
83
|
+
form = form_for(tense, aspect, diathesis) # find form array based on tense and aspect
|
84
84
|
|
85
85
|
# map form array to conjugation array, applying infinitive and options to the array
|
86
86
|
conjugation = form.map { |e| resolve e, infinitive, tense, person, plurality, mood }.join(' ').strip
|
@@ -275,23 +275,41 @@ module Verbs
|
|
275
275
|
# Params:
|
276
276
|
# * tense, an option given by the user
|
277
277
|
# * aspect, an option given by the user
|
278
|
-
|
278
|
+
# * diathesis, an option given by the user
|
279
|
+
def form_for(tense, aspect, diathesis)
|
279
280
|
form = []
|
280
|
-
if
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
281
|
+
if diathesis == :active
|
282
|
+
if tense == :future
|
283
|
+
form << 'will'
|
284
|
+
form << :infinitive if aspect == :habitual
|
285
|
+
form.concat ['have', :past_participle] if aspect == :perfect
|
286
|
+
form.concat ['be having', :past_participle] if aspect == :perfective
|
287
|
+
form.concat ['be', :present_participle] if aspect == :progressive
|
288
|
+
form.concat ['be about to', :infinitive] if aspect == :prospective
|
289
|
+
else
|
290
|
+
form.concat ['used to', :infinitive] if [tense, aspect] == [:past, :habitual]
|
291
|
+
form.concat [:have, :past_participle] if aspect == :perfect
|
292
|
+
form << :past if [tense, aspect] == [:past, :perfective]
|
293
|
+
form.concat [:be, :present_participle] if aspect == :progressive
|
294
|
+
form.concat [:be, 'about to', :infinitive] if aspect == :prospective
|
295
|
+
form << :present if [tense, aspect] == [:present, :habitual]
|
296
|
+
form.concat [:be, 'having', :past_participle] if [tense, aspect] == [:present, :perfective]
|
297
|
+
end
|
298
|
+
elsif diathesis == :passive
|
299
|
+
if tense == :future
|
300
|
+
form << 'will'
|
301
|
+
form.concat ['be', :past_participle] if aspect == :habitual
|
302
|
+
form.concat ['have been', :past_participle] if aspect == :perfect
|
303
|
+
form.concat ['be being', :past_participle] if aspect == :progressive
|
304
|
+
form.concat ['be about to be', :past_participle] if aspect == :prospective
|
305
|
+
else
|
306
|
+
form.concat ['used to be', :past_participle] if [tense, aspect] == [:past, :habitual]
|
307
|
+
form.concat [:have, 'been', :past_participle] if aspect == :perfect
|
308
|
+
form.concat [:be, :past_participle] if [tense, aspect] == [:past, :perfective]
|
309
|
+
form.concat [:be, 'being', :past_participle] if aspect == :progressive
|
310
|
+
form.concat [:be, 'about to be', :past_participle] if aspect == :prospective
|
311
|
+
form.concat [:be, :past_participle] if [tense, aspect] == [:present, :habitual]
|
312
|
+
end
|
295
313
|
end
|
296
314
|
form
|
297
315
|
end
|
@@ -301,10 +319,14 @@ module Verbs
|
|
301
319
|
# * tense, an option given by the user
|
302
320
|
# * person, how the conjugation refers to the subject
|
303
321
|
# * mood, an option given by the user
|
304
|
-
|
322
|
+
# * diathesis, an option given by the user
|
323
|
+
def check_for_improper_constructions(infinitive, tense, person, mood, diathesis)
|
305
324
|
if mood == :imperative and not (person == :second and tense == :present)
|
306
325
|
raise Verbs::ImproperConstruction, 'The imperative mood requires present tense and second person'
|
307
326
|
end
|
327
|
+
if infinitive.to_sym == :be and diathesis == :passive
|
328
|
+
raise Verbs::ImproperConstruction, 'There is no passive diathesis for the copula'
|
329
|
+
end
|
308
330
|
end
|
309
331
|
end
|
310
332
|
end
|
data/lib/verbs/version.rb
CHANGED
data/test/test_verbs.rb
CHANGED
@@ -174,4 +174,42 @@ class TestVerbs < Test::Unit::TestCase
|
|
174
174
|
assert_equal 'You were about to accept', standard.conjugate(:accept, :tense => :past, :aspect => :prospective)
|
175
175
|
end
|
176
176
|
end
|
177
|
+
|
178
|
+
def test_passive
|
179
|
+
Verbs::Conjugator.with_options :diathesis => :passive, :person => :first, :plurality => :singular, :subject => true do |standard|
|
180
|
+
assert_equal 'I used to be accepted', standard.conjugate(:accept, :tense => :past, :aspect => :habitual)
|
181
|
+
assert_equal 'I had been accepted', standard.conjugate(:accept, :tense => :past, :aspect => :perfect)
|
182
|
+
assert_equal 'I was accepted', standard.conjugate(:accept, :tense => :past, :aspect => :perfective)
|
183
|
+
assert_equal 'I was being accepted', standard.conjugate(:accept, :tense => :past, :aspect => :progressive)
|
184
|
+
assert_equal 'I was about to be accepted', standard.conjugate(:accept, :tense => :past, :aspect => :prospective)
|
185
|
+
assert_equal 'I am accepted', standard.conjugate(:accept, :tense => :present, :aspect => :habitual)
|
186
|
+
assert_equal 'I have been accepted', standard.conjugate(:accept, :tense => :present, :aspect => :perfect)
|
187
|
+
assert_equal 'I am being accepted', standard.conjugate(:accept, :tense => :present, :aspect => :progressive)
|
188
|
+
assert_equal 'I am about to be accepted', standard.conjugate(:accept, :tense => :present, :aspect => :prospective)
|
189
|
+
assert_equal 'I will be accepted', standard.conjugate(:accept, :tense => :future, :aspect => :habitual)
|
190
|
+
assert_equal 'I will have been accepted', standard.conjugate(:accept, :tense => :future, :aspect => :perfect)
|
191
|
+
assert_equal 'I will be being accepted', standard.conjugate(:accept, :tense => :future, :aspect => :progressive)
|
192
|
+
assert_equal 'I will be about to be accepted', standard.conjugate(:accept, :tense => :future, :aspect => :prospective)
|
193
|
+
end
|
194
|
+
|
195
|
+
Verbs::Conjugator.with_options :diathesis => :passive, :person => :third, :plurality => :plural, :subject => true do |standard|
|
196
|
+
assert_equal 'They used to be accepted', standard.conjugate(:accept, :tense => :past, :aspect => :habitual)
|
197
|
+
assert_equal 'They had been accepted', standard.conjugate(:accept, :tense => :past, :aspect => :perfect)
|
198
|
+
assert_equal 'They were accepted', standard.conjugate(:accept, :tense => :past, :aspect => :perfective)
|
199
|
+
assert_equal 'They were being accepted', standard.conjugate(:accept, :tense => :past, :aspect => :progressive)
|
200
|
+
assert_equal 'They were about to be accepted', standard.conjugate(:accept, :tense => :past, :aspect => :prospective)
|
201
|
+
assert_equal 'They are accepted', standard.conjugate(:accept, :tense => :present, :aspect => :habitual)
|
202
|
+
assert_equal 'They have been accepted', standard.conjugate(:accept, :tense => :present, :aspect => :perfect)
|
203
|
+
assert_equal 'They are being accepted', standard.conjugate(:accept, :tense => :present, :aspect => :progressive)
|
204
|
+
assert_equal 'They are about to be accepted', standard.conjugate(:accept, :tense => :present, :aspect => :prospective)
|
205
|
+
assert_equal 'They will be accepted', standard.conjugate(:accept, :tense => :future, :aspect => :habitual)
|
206
|
+
assert_equal 'They will have been accepted', standard.conjugate(:accept, :tense => :future, :aspect => :perfect)
|
207
|
+
assert_equal 'They will be being accepted', standard.conjugate(:accept, :tense => :future, :aspect => :progressive)
|
208
|
+
assert_equal 'They will be about to be accepted', standard.conjugate(:accept, :tense => :future, :aspect => :prospective)
|
209
|
+
end
|
210
|
+
|
211
|
+
assert_raise Verbs::ImproperConstruction do
|
212
|
+
Verbs::Conjugator.conjugate(:be, :diathesis => :passive)
|
213
|
+
end
|
214
|
+
end
|
177
215
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: verbs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Rossmeissl
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-unit
|
@@ -81,7 +81,6 @@ files:
|
|
81
81
|
- LICENSE
|
82
82
|
- README.rdoc
|
83
83
|
- Rakefile
|
84
|
-
- VERSION
|
85
84
|
- lib/verbs.rb
|
86
85
|
- lib/verbs/conjugations.rb
|
87
86
|
- lib/verbs/conjugator.rb
|
@@ -110,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
109
|
- !ruby/object:Gem::Version
|
111
110
|
version: '0'
|
112
111
|
requirements: []
|
113
|
-
rubygems_version: 3.
|
112
|
+
rubygems_version: 3.1.2
|
114
113
|
signing_key:
|
115
114
|
specification_version: 4
|
116
115
|
summary: English verb conjugation in Ruby
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.0.10
|