lib/phonos/analyzer.rb in phonos-1.2.3 vs lib/phonos/analyzer.rb in phonos-1.2.4

- old
+ new

@@ -1,8 +1,10 @@ # encoding: utf-8 $KCODE='u' +require 'pp' + module Phonos require 'mathn' SCALES = [ :good, :big, :gentle, :feminine, :light, :active, :simple, :strong, :hot, @@ -10,11 +12,11 @@ :glad, :loud, :long, :brave, :kind, :mighty, :mobile ] PATTERNS = { :ru => { :detect => /[а-я]/, :select => [ - [/[^а-я]/, ''], + [/[^а-яё]/, ''], [/[бвгджзклмнпрстфхцчшщ][еёиьюя]/, Proc.new { |match| match.mb_chars.capitalize }] ] } } class Analyzer @@ -94,11 +96,12 @@ f1 = {} f2 = {} data.each do |lang, words| table = @cache.read "#{lang}_phonos" unless table - table = YAML.load_file File.expand_path("../../../share/#{lang}.yaml", __FILE__) - @cache.write "#{lang}_phonos", table + table = Phonos::Language::RUSSIAN +# table = YAML.load_file File.expand_path("../../../share/#{lang}.yaml", __FILE__) +# @cache.write "#{lang}_phonos", table end words.join('').each_char do |c| char = stats[lang][c] SCALES.each do |scale| f1[scale] ||= 0