fonemas 0.2.1 → 0.2.2
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.
- checksums.yaml +8 -8
 - data/lib/fonemas.rb +18 -2
 - data/lib/fonemas/version.rb +1 -1
 - data/spec/fonemas/fonema_spec.rb +4 -0
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,15 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            !binary "U0hBMQ==":
         
     | 
| 
       3 
3 
     | 
    
         
             
              metadata.gz: !binary |-
         
     | 
| 
       4 
     | 
    
         
            -
                 
     | 
| 
      
 4 
     | 
    
         
            +
                NTljZGFkNDZlZTQ5MDhmZTM2NGY1YjY4NmQ3NTY5MTU5MTVmMTZmMQ==
         
     | 
| 
       5 
5 
     | 
    
         
             
              data.tar.gz: !binary |-
         
     | 
| 
       6 
     | 
    
         
            -
                 
     | 
| 
      
 6 
     | 
    
         
            +
                NGI2YWU2MmVhNDU4YWFmNGEwMjg3MjBlMGU3NTk0ZjAyNjhhMTU0OQ==
         
     | 
| 
       7 
7 
     | 
    
         
             
            !binary "U0hBNTEy":
         
     | 
| 
       8 
8 
     | 
    
         
             
              metadata.gz: !binary |-
         
     | 
| 
       9 
     | 
    
         
            -
                 
     | 
| 
       10 
     | 
    
         
            -
                 
     | 
| 
       11 
     | 
    
         
            -
                 
     | 
| 
      
 9 
     | 
    
         
            +
                ZjgxMmI4ZDgzNTExMGM0NWQ2MTdhMTZkYzNjOWQ0YTg2Y2I4MTQ0OGZiMzgw
         
     | 
| 
      
 10 
     | 
    
         
            +
                ZTNjNzM3YmYxNDk1YTFlNTU1NTFjYTk3NjI2YjA4ZTEyN2U4NzQzNjkzZjc3
         
     | 
| 
      
 11 
     | 
    
         
            +
                OGM4MjcwNDE0ZmJlYmIxYzQ1YjZhZDEyNjQ0OTFiNDdmZWNhMDk=
         
     | 
| 
       12 
12 
     | 
    
         
             
              data.tar.gz: !binary |-
         
     | 
| 
       13 
     | 
    
         
            -
                 
     | 
| 
       14 
     | 
    
         
            -
                 
     | 
| 
       15 
     | 
    
         
            -
                 
     | 
| 
      
 13 
     | 
    
         
            +
                NTE5NDBiYWRmODFhNmIwMTIzMDU4OTgxZWJjZDdmOTQ4MzJjNDQ4MzI3Yzgy
         
     | 
| 
      
 14 
     | 
    
         
            +
                NDE2MTQwMjlkYmY3MTI3MzI1M2JlNzRmNjYxYjhmMTAwZjE5YzZjNTQ2ZWI5
         
     | 
| 
      
 15 
     | 
    
         
            +
                MWFhNzM4MmYwMzUyNGIxYjE0OGFlYzE3NjJiZWVhY2U1Yzk2ODg=
         
     | 
    
        data/lib/fonemas.rb
    CHANGED
    
    | 
         @@ -35,6 +35,7 @@ module Fonemas 
     | 
|
| 
       35 
35 
     | 
    
         | 
| 
       36 
36 
     | 
    
         
             
              def self.isTonica(word,i)
         
     | 
| 
       37 
37 
     | 
    
         
             
                #falta considerar las palabras que poseen acento pero no tilde
         
     | 
| 
      
 38 
     | 
    
         
            +
                return true if word.size == 1
         
     | 
| 
       38 
39 
     | 
    
         
             
                tildes = %w(á é í ó ú)
         
     | 
| 
       39 
40 
     | 
    
         
             
                w = word.join
         
     | 
| 
       40 
41 
     | 
    
         
             
                if tildes.include? word[i]
         
     | 
| 
         @@ -157,6 +158,15 @@ module Fonemas 
     | 
|
| 
       157 
158 
     | 
    
         
             
              end
         
     | 
| 
       158 
159 
     | 
    
         | 
| 
       159 
160 
     | 
    
         
             
              def self.fonemas(word)
         
     | 
| 
      
 161 
     | 
    
         
            +
                if word.include?('_')
         
     | 
| 
      
 162 
     | 
    
         
            +
                  output = []
         
     | 
| 
      
 163 
     | 
    
         
            +
                  for a in word.split('_')
         
     | 
| 
      
 164 
     | 
    
         
            +
                    if a.size > 0
         
     | 
| 
      
 165 
     | 
    
         
            +
                      output << Fonemas.fonemas(a)
         
     | 
| 
      
 166 
     | 
    
         
            +
                    end
         
     | 
| 
      
 167 
     | 
    
         
            +
                  end
         
     | 
| 
      
 168 
     | 
    
         
            +
                  return output.join(' ')
         
     | 
| 
      
 169 
     | 
    
         
            +
                end
         
     | 
| 
       160 
170 
     | 
    
         
             
                word = separar(word)
         
     | 
| 
       161 
171 
     | 
    
         
             
                fonema = []
         
     | 
| 
       162 
172 
     | 
    
         
             
                for i in 0..(word.length-1)
         
     | 
| 
         @@ -179,7 +189,10 @@ module Fonemas 
     | 
|
| 
       179 
189 
     | 
    
         
             
                        fonema << 'a'
         
     | 
| 
       180 
190 
     | 
    
         
             
                      end
         
     | 
| 
       181 
191 
     | 
    
         
             
                    when 'b','v' then
         
     | 
| 
       182 
     | 
    
         
            -
                      if  
     | 
| 
      
 192 
     | 
    
         
            +
                      if word.size() == 1
         
     | 
| 
      
 193 
     | 
    
         
            +
                        fonema << 'bb'
         
     | 
| 
      
 194 
     | 
    
         
            +
                        fonema << 'ee'
         
     | 
| 
      
 195 
     | 
    
         
            +
                      elsif isVocal(word,i-1) and (word[i+1] == 'b' or word[i+1] == 'v')
         
     | 
| 
       183 
196 
     | 
    
         
             
                        fonema << ['bb','']
         
     | 
| 
       184 
197 
     | 
    
         
             
                      elsif i == 0 and isVocal(word,i+1)
         
     | 
| 
       185 
198 
     | 
    
         
             
                        if word[i+1] == 'u' and isDiptongo(word,i+1,i+2)
         
     | 
| 
         @@ -203,7 +216,10 @@ module Fonemas 
     | 
|
| 
       203 
216 
     | 
    
         
             
                        fonema << 'bb'
         
     | 
| 
       204 
217 
     | 
    
         
             
                      end
         
     | 
| 
       205 
218 
     | 
    
         
             
                    when 'c' then
         
     | 
| 
       206 
     | 
    
         
            -
                      if word 
     | 
| 
      
 219 
     | 
    
         
            +
                      if word.size() == 1
         
     | 
| 
      
 220 
     | 
    
         
            +
                         fonema << 's'
         
     | 
| 
      
 221 
     | 
    
         
            +
                         fonema << 'ee'
         
     | 
| 
      
 222 
     | 
    
         
            +
                      elsif word[i+1] == 'e' or word[i+1] == 'i'
         
     | 
| 
       207 
223 
     | 
    
         
             
                        fonema << 's'
         
     | 
| 
       208 
224 
     | 
    
         
             
                      else
         
     | 
| 
       209 
225 
     | 
    
         
             
                        fonema << 'k'
         
     | 
    
        data/lib/fonemas/version.rb
    CHANGED
    
    
    
        data/spec/fonemas/fonema_spec.rb
    CHANGED
    
    | 
         @@ -56,6 +56,10 @@ describe Fonemas do 
     | 
|
| 
       56 
56 
     | 
    
         
             
                Fonemas.fonemas('África').should include('aa f r i k a')
         
     | 
| 
       57 
57 
     | 
    
         
             
              end
         
     | 
| 
       58 
58 
     | 
    
         | 
| 
      
 59 
     | 
    
         
            +
              it 'palabras deletreadas' do
         
     | 
| 
      
 60 
     | 
    
         
            +
                Fonemas.fonemas('_a_b_c').should include('aa bb ee s ee')
         
     | 
| 
      
 61 
     | 
    
         
            +
              end
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
       59 
63 
     | 
    
         
             
              it 'test diptongos' do
         
     | 
| 
       60 
64 
     | 
    
         
             
                Fonemas.isDiptongo("buitre",1,2).should be(true)
         
     | 
| 
       61 
65 
     | 
    
         
             
              end
         
     |