Sha256: 80e06c3b969f91da7a61811b922616d126e3121348f4d383887f919682bad534

Contents?: true

Size: 829 Bytes

Versions: 3

Compression:

Stored size: 829 Bytes

Contents

#!/usr/bin/env ruby

$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')

require 'fonemas'

if ARGV.include?('--list')
   puts Fonemas.lista_de_fonemas.join("\n")
   exit
end

if ARGV.include?('--word')
  puts Fonemas.fonemas(ARGV[1])
  exit
end

if ARGV.include?('--version')
  puts Fonemas.version
  exit
end

ARGF.set_encoding('UTF-8')

input = ARGF.readlines

words = []

for i in input
    #1 palabra por linea
	words << Fonemas.downcase(i.split(' ')[0].split('(')[0])
end

words = words.sort
words = words.uniq


for i in words
  fonemas = Fonemas.fonemas(i)
  count = 0
  begin
    for f in fonemas
      if count > 0
        puts "#{i}(#{count})\t#{f}"
      else
        puts "#{i}\t#{f}"
      end
      count += 1
    end
  rescue
    puts "error al procesar fonemas para #{i}"
    exit
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fonemas-0.2.9 bin/fonemas
fonemas-0.2.8 bin/fonemas
fonemas-0.2.7 bin/fonemas