pascoale 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pascoale/reflector.rb +10 -2
- data/lib/pascoale/version.rb +1 -1
- data/spec/lib/pascoale/reflector_spec.rb +3 -0
- 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: 7c29f334c80514fa47e9fe2f725f4ee72805fd23
|
4
|
+
data.tar.gz: e932c003c4e9c6c193c4bdb45c2373d2c87f0564
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 495abc17e08f8e5a791f6df943c897e341c8919f997dc9609e198be79f4012c66a8880b662d7f3df7347ee3ccc6192a56a35223b893b12905f59dc106620aca7
|
7
|
+
data.tar.gz: 2604c9bb04cbe9197a58c5010f192c47cdea503f893a38328cb960cb241079b193be37b9f80cc2baf6ef0da107b96d4023a1d032abd1f7616b71070d970ac94e
|
data/lib/pascoale/reflector.rb
CHANGED
@@ -15,8 +15,6 @@ module Pascoale
|
|
15
15
|
|
16
16
|
# Most common case in portuguese
|
17
17
|
def paroxytone?
|
18
|
-
return false if separated.size < 2
|
19
|
-
return true if separated[-2] =~ /[#{ACCENTED}]/
|
20
18
|
!proparoxytone? && !oxytone?
|
21
19
|
end
|
22
20
|
|
@@ -24,9 +22,19 @@ module Pascoale
|
|
24
22
|
def oxytone?
|
25
23
|
return true if separated.size == 1
|
26
24
|
return true if separated[-1] =~ /[#{ACCENTED}]/
|
25
|
+
return false if separated[-2] =~ /[#{ACCENTED}]/
|
26
|
+
return false if separated[-3] =~ /[#{ACCENTED}]/
|
27
27
|
separated[-1] =~ /(is?|im|ins?|us?|um|uns?|l|n|r|x|ps|ãs?|ãos?|ons?|ais?|eis?|ois?|aus?|eus?|ous?|ias?|ies?|ios?|uas?|ues?|uos?)$/
|
28
28
|
end
|
29
29
|
|
30
|
+
def syllable_index
|
31
|
+
return -1 if oxytone?
|
32
|
+
return -2 if paroxytone?
|
33
|
+
return -3 if proparoxytone?
|
34
|
+
# Shoud never happen because defaut is paroxytone
|
35
|
+
raise "Can't understand word"
|
36
|
+
end
|
37
|
+
|
30
38
|
private
|
31
39
|
|
32
40
|
def separated
|
data/lib/pascoale/version.rb
CHANGED
@@ -35,6 +35,9 @@ describe Reflector do
|
|
35
35
|
expect(Reflector.new('ruim')).to be_oxytone
|
36
36
|
expect(Reflector.new('condor')).to be_oxytone
|
37
37
|
expect(Reflector.new('anzol')).to be_oxytone
|
38
|
+
expect(Reflector.new('variável')).not_to be_oxytone
|
39
|
+
expect(Reflector.new('prováveis')).not_to be_oxytone
|
40
|
+
expect(Reflector.new('ámavel')).not_to be_oxytone
|
38
41
|
end
|
39
42
|
end
|
40
43
|
|