phonos 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,23 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+ nbproject
21
+ .rvmrc
22
+
23
+ ## PROJECT::SPECIFIC
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Lumren Randir
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,17 @@
1
+ = phonos
2
+
3
+ Description goes here.
4
+
5
+ == Note on Patches/Pull Requests
6
+
7
+ * Fork the project.
8
+ * Make your feature addition or bug fix.
9
+ * Add tests for it. This is important so I don't break it in a
10
+ future version unintentionally.
11
+ * Commit, do not mess with rakefile, version, or history.
12
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
13
+ * Send me a pull request. Bonus points for topic branches.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2010 Lumren Randir. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,55 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "phonos"
8
+ gem.summary = 'Phonos Phonosemantics Gem'
9
+ gem.description = 'Phonos, the Phonosemantics Analyser'
10
+ gem.email = "lumrandir@gmail.com"
11
+ gem.homepage = "http://feeltoday.ru/"
12
+ gem.authors = ["Lumren Randir"]
13
+ gem.add_development_dependency "shoulda", ">= 2.10.3"
14
+ #gem.add_dependency "unicode", ">= 0.3.1"
15
+ gem.add_dependency 'activesupport'
16
+ gem.add_dependency 'i18n'
17
+ end
18
+ Jeweler::GemcutterTasks.new
19
+ rescue LoadError
20
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
21
+ end
22
+
23
+ require 'rake/testtask'
24
+ Rake::TestTask.new(:test) do |test|
25
+ test.libs << 'lib' << 'test'
26
+ test.pattern = 'test/**/test_*.rb'
27
+ test.verbose = true
28
+ end
29
+
30
+ begin
31
+ require 'rcov/rcovtask'
32
+ Rcov::RcovTask.new do |test|
33
+ test.libs << 'test'
34
+ test.pattern = 'test/**/test_*.rb'
35
+ test.verbose = true
36
+ end
37
+ rescue LoadError
38
+ task :rcov do
39
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
40
+ end
41
+ end
42
+
43
+ task :test => :check_dependencies
44
+
45
+ task :default => :test
46
+
47
+ require 'rake/rdoctask'
48
+ Rake::RDocTask.new do |rdoc|
49
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
50
+
51
+ rdoc.rdoc_dir = 'rdoc'
52
+ rdoc.title = "phonos #{version}"
53
+ rdoc.rdoc_files.include('README*')
54
+ rdoc.rdoc_files.include('lib/**/*.rb')
55
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.2.0
@@ -0,0 +1,136 @@
1
+ # encoding: utf-8
2
+ $KCODE='u'
3
+
4
+ module Phonos
5
+ require 'mathn'
6
+
7
+ SCALES = [
8
+ :good, :big, :gentle, :feminine, :light, :active, :simple, :strong, :hot,
9
+ :fast, :beautiful, :smooth, :easy, :gay, :safe, :majestic, :bright, :rounded,
10
+ :glad, :loud, :long, :brave, :kind, :mighty, :mobile
11
+ ]
12
+
13
+ PATTERNS = {
14
+ :ru => { :detect => /[а-я]/, :select => [
15
+ [/[^а-я]/, ''],
16
+ [/[бвгджзклмнпрстфхцчшщ][еёиьюя]/, Proc.new { |match| match.mb_chars.capitalize }]
17
+ ] }
18
+ }
19
+
20
+ class Analyzer
21
+ def initialize(*args)
22
+ @cache = if args.last.kind_of? ActiveSupport::Cache::Store
23
+ args.pop
24
+ else
25
+ ActiveSupport::Cache.lookup_store :memory_store
26
+ end
27
+ @langs = args.clone
28
+ end
29
+
30
+ def analyze raw_text
31
+ data = prepare raw_text
32
+ calculate data, get_stats(data)
33
+ end
34
+
35
+ def prepare raw_text
36
+ data = {}
37
+ raw_text.mb_chars.downcase.gsub(/@\w+/, '').split.each do |w|
38
+ lang = detect w
39
+ data[lang] ||= []
40
+ data[lang] << filter(w, lang)
41
+ end
42
+ data
43
+ end
44
+ private :prepare
45
+
46
+ def detect word
47
+ @langs.each do |l|
48
+ if word =~ PATTERNS[l][:detect]
49
+ return l
50
+ end
51
+ end
52
+ nil
53
+ end
54
+ private :detect
55
+
56
+ def filter w, l
57
+ PATTERNS[l][:select].each do |p|
58
+ if p.last.kind_of? Proc
59
+ w.mb_chars.gsub!(p.first, &p.last)
60
+ else
61
+ w.mb_chars.gsub!(p.first, p.last)
62
+ end
63
+ end
64
+ w.to_s
65
+ end
66
+ private :filter
67
+
68
+ def get_stats data
69
+ stats = {}
70
+ data.each do |lang, words|
71
+ string = words.join ' '
72
+ stats[lang] ||= {}
73
+ stats[:space] ||= 0
74
+ stats[:total] ||= 0
75
+ stats[:space] += StringCrutch.count(string, ' ')
76
+ stats[:total] += string.mb_chars.size - stats[:space]
77
+ words.each do |word|
78
+ word.chars.to_a.uniq.each do |char|
79
+ stats[lang][char] ||= {}
80
+ stats[lang][char][:abs] ||= 0
81
+ stats[lang][char][:abs] += StringCrutch.count(word, char)
82
+ stats[lang][char][:rel] = stats[lang][char][:abs]
83
+ end
84
+ stats[lang][word.chars.first][:rel] += 2
85
+ end
86
+ end
87
+ stats
88
+ end
89
+ private :get_stats
90
+
91
+ def calculate data, stats
92
+ f1 = {}
93
+ f2 = {}
94
+ data.each do |lang, words|
95
+ table = @cache.read "#{lang}_phonos"
96
+ unless table
97
+ table = YAML.load_file "./share/#{lang}.yaml"
98
+ @cache.write "#{lang}_phonos", table
99
+ end
100
+ words.join('').each_char do |c|
101
+ char = stats[lang][c]
102
+ SCALES.each do |scale|
103
+ f1[scale] ||= 0
104
+ f2[scale] ||= 0
105
+ if table[c]
106
+ if stats[:space] <= 4 && char[:abs] / stats[:total] > 0.368
107
+ f1[scale] += (table[c][scale] * char[:rel] / char[:abs] * (-0.368)) /
108
+ (table[c][:frequency] * Math.log(table[c][:frequency]))
109
+ f2[scale] += (char[:rel] / char[:abs] * (-0.368)) /
110
+ (table[c][:frequency] * Math.log(table[c][:frequency]))
111
+ else
112
+ f1[scale] += (table[c][scale] * char[:rel] / stats[:total] *
113
+ Math.log(char[:abs] / stats[:total])) / (table[c][:frequency] *
114
+ Math.log(table[c][:frequency]))
115
+ f2[scale] += (char[:rel] / stats[:total] *
116
+ Math.log(char[:abs] / stats[:total])) / (table[c][:frequency] *
117
+ Math.log(table[c][:frequency]))
118
+ end
119
+ end
120
+ end
121
+ end
122
+ end
123
+ SCALES.inject({}) do |r, scale|
124
+ p f1, f2
125
+ val = if f1[scale] && f2[scale]
126
+ f1[scale] / f2[scale]
127
+ else
128
+ 1.0
129
+ end
130
+ r[scale] = 3.0 - val
131
+ r
132
+ end
133
+ end
134
+ private :calculate
135
+ end
136
+ end
@@ -0,0 +1,83 @@
1
+ # encoding: utf-8
2
+
3
+ module Phonos::Language
4
+ RUSSIAN = {
5
+ "в" => { :good => 2.9, :big => 2.1, :gentle => 3.6, :feminine => 3.9, :light => 3.0, :active => 2.4, :simple => 2.4, :strong => 1.9, :hot => 2.4, :fast => 2.4, :beautiful => 3.0, :smooth => 3.5, :easy => 3.3, :gay => 2.5, :safe => 3.3, :majestic => 1.8, :bright => 2.7, :rounded => 2.9, :glad => 2.3, :loud => 2.2, :long => 3.8, :brave => 2.5, :kind => 2.8, :mighty => 1.8, :mobile => 2.6, :frequency => 0.028 },
6
+ "с" => { :good => 3.6, :big => 3.5, :gentle => 3.2, :feminine => 3.1, :light => 2.5, :active => 3.2, :simple => 3.0, :strong => 3.1, :hot => 3.3, :fast => 3.0, :beautiful => 3.9, :smooth => 3.6, :easy => 2.4, :gay => 2.9, :safe => 3.2, :majestic => 3.6, :bright => 3.8, :rounded => 3.1, :glad => 3.5, :loud => 3.8, :long => 3.7, :brave => 4.0, :kind => 3.9, :mighty => 3.5, :mobile => 3.5, :frequency => 0.032 },
7
+ "а" => { :good => 1.5, :big => 1.8, :gentle => 2.8, :feminine => 3.7, :light => 2.2, :active => 2.1, :simple => 1.4, :strong => 2.6, :hot => 3.2, :fast => 3.4, :beautiful => 2.0, :smooth => 1.6, :easy => 2.3, :gay => 2.7, :safe => 2.6, :majestic => 2.0, :bright => 2.0, :rounded => 1.4, :glad => 1.9, :loud => 1.9, :long => 1.8, :brave => 1.8, :kind => 2.0, :mighty => 1.8, :mobile => 2.9, :frequency => 0.049 },
8
+ "А" => { :good => 1.5, :big => 1.8, :gentle => 2.8, :feminine => 3.7, :light => 2.2, :active => 2.1, :simple => 1.4, :strong => 2.6, :hot => 3.2, :fast => 3.4, :beautiful => 2.0, :smooth => 1.6, :easy => 2.3, :gay => 2.7, :safe => 2.6, :majestic => 2.0, :bright => 2.0, :rounded => 1.4, :glad => 1.9, :loud => 1.9, :long => 1.8, :brave => 1.8, :kind => 2.0, :mighty => 1.8, :mobile => 2.9, :frequency => 0.046 },
9
+ "Д" => { :good => 2.8, :big => 3.9, :gentle => 2.6, :feminine => 2.5, :light => 2.2, :active => 2.0, :simple => 3.6, :strong => 3.2, :hot => 2.3, :fast => 2.2, :beautiful => 2.7, :smooth => 3.0, :easy => 2.8, :gay => 2.1, :safe => 2.8, :majestic => 3.5, :bright => 2.2, :rounded => 3.2, :glad => 2.3, :loud => 2.7, :long => 4.3, :brave => 2.6, :kind => 1.4, :mighty => 3.4, :mobile => 2.3, :frequency => 0.017 },
10
+ "ж" => { :good => 3.7, :big => 2.4, :gentle => 4.0, :feminine => 3.2, :light => 3.8, :active => 3.0, :simple => 4.0, :strong => 2.5, :hot => 2.3, :fast => 3.4, :beautiful => 4.0, :smooth => 4.5, :easy => 4.0, :gay => 2.7, :safe => 4.3, :majestic => 3.6, :bright => 2.9, :rounded => 3.4, :glad => 3.5, :loud => 2.9, :long => 3.0, :brave => 1.9, :kind => 4.1, :mighty => 2.3, :mobile => 3.2, :frequency => 0.008 },
11
+ "Ж" => { :good => 3.7, :big => 2.4, :gentle => 4.0, :feminine => 3.2, :light => 3.8, :active => 3.0, :simple => 4.0, :strong => 2.5, :hot => 2.3, :fast => 3.4, :beautiful => 4.0, :smooth => 4.5, :easy => 4.0, :gay => 2.7, :safe => 4.3, :majestic => 3.6, :bright => 2.9, :rounded => 3.4, :glad => 3.5, :loud => 2.9, :long => 3.0, :brave => 1.9, :kind => 4.1, :mighty => 2.3, :mobile => 3.2, :frequency => 0.008 },
12
+ "й" => { :good => 2.9, :big => 3.8, :gentle => 3.1, :feminine => 3.2, :light => 2.6, :active => 2.2, :simple => 3.9, :strong => 3.2, :hot => 2.6, :fast => 1.8, :beautiful => 2.8, :smooth => 3.4, :easy => 2.5, :gay => 2.6, :safe => 2.4, :majestic => 3.0, :bright => 2.4, :rounded => 3.2, :glad => 2.9, :loud => 2.7, :long => 4.1, :brave => 3.2, :kind => 3.3, :mighty => 3.0, :mobile => 1.9, :frequency => 0.013 },
13
+ "ю" => { :good => 1.8, :big => 3.1, :gentle => 1.9, :feminine => 1.6, :light => 2.3, :active => 3.4, :simple => 2.6, :strong => 3.8, :hot => 2.8, :fast => 3.6, :beautiful => 1.6, :smooth => 2.4, :easy => 2.1, :gay => 2.5, :safe => 2.0, :majestic => 2.8, :bright => 2.5, :rounded => 2.0, :glad => 2.5, :loud => 3.2, :long => 2.6, :brave => 2.8, :kind => 2.2, :mighty => 3.4, :mobile => 3.2, :frequency => 0.004 },
14
+ "Ю" => { :good => 1.8, :big => 3.1, :gentle => 1.9, :feminine => 1.6, :light => 2.3, :active => 3.4, :simple => 2.6, :strong => 3.8, :hot => 2.8, :fast => 3.6, :beautiful => 1.6, :smooth => 2.4, :easy => 2.1, :gay => 2.5, :safe => 2.0, :majestic => 2.8, :bright => 2.5, :rounded => 2.0, :glad => 2.5, :loud => 3.2, :long => 2.6, :brave => 2.8, :kind => 2.2, :mighty => 3.4, :mobile => 3.2, :frequency => 0.002 },
15
+ "Р" => { :good => 2.6, :big => 3.4, :gentle => 3.2, :feminine => 2.9, :light => 2.9, :active => 2.1, :simple => 3.7, :strong => 3.0, :hot => 2.7, :fast => 2.4, :beautiful => 3.6, :smooth => 4.0, :easy => 3.3, :gay => 2.4, :safe => 3.4, :majestic => 2.8, :bright => 1.8, :rounded => 4.0, :glad => 1.9, :loud => 2.1, :long => 3.5, :brave => 2.5, :kind => 3.3, :mighty => 2.5, :mobile => 2.1, :frequency => 0.014 },
16
+ "ш" => { :good => 4.0, :big => 3.2, :gentle => 3.2, :feminine => 2.8, :light => 4.3, :active => 3.6, :simple => 3.1, :strong => 3.4, :hot => 2.8, :fast => 3.1, :beautiful => 3.5, :smooth => 4.1, :easy => 3.4, :gay => 3.6, :safe => 4.2, :majestic => 4.0, :bright => 4.5, :rounded => 3.5, :glad => 3.8, :loud => 4.7, :long => 3.3, :brave => 3.3, :kind => 3.4, :mighty => 2.6, :mobile => 3.5, :frequency => 0.012 },
17
+ "Ш" => { :good => 4.0, :big => 3.2, :gentle => 3.2, :feminine => 2.8, :light => 4.3, :active => 3.6, :simple => 3.1, :strong => 3.4, :hot => 2.8, :fast => 3.1, :beautiful => 3.5, :smooth => 4.1, :easy => 3.4, :gay => 3.6, :safe => 4.2, :majestic => 4.0, :bright => 4.5, :rounded => 3.5, :glad => 3.8, :loud => 4.7, :long => 3.3, :brave => 3.3, :kind => 3.4, :mighty => 2.6, :mobile => 3.5, :frequency => 0.012 },
18
+ "г" => { :good => 3.2, :big => 2.6, :gentle => 3.8, :feminine => 4.2, :light => 3.3, :active => 2.8, :simple => 2.6, :strong => 2.2, :hot => 3.6, :fast => 2.2, :beautiful => 2.8, :smooth => 3.6, :easy => 3.0, :gay => 2.9, :safe => 3.2, :majestic => 2.8, :bright => 2.5, :rounded => 4.0, :glad => 3.0, :loud => 3.3, :long => 3.9, :brave => 2.8, :kind => 3.8, :mighty => 2.4, :mobile => 2.2, :frequency => 0.012 },
19
+ "и" => { :good => 1.7, :big => 3.2, :gentle => 1.8, :feminine => 1.9, :light => 2.0, :active => 2.9, :simple => 1.8, :strong => 3.3, :hot => 3.2, :fast => 3.6, :beautiful => 2.0, :smooth => 2.0, :easy => 2.0, :gay => 2.5, :safe => 2.1, :majestic => 3.0, :bright => 2.6, :rounded => 2.2, :glad => 2.3, :loud => 3.3, :long => 2.5, :brave => 2.9, :kind => 2.4, :mighty => 3.9, :mobile => 3.4, :frequency => 0.041 },
20
+ "И" => { :good => 1.7, :big => 3.2, :gentle => 1.8, :feminine => 1.9, :light => 2.0, :active => 2.9, :simple => 1.8, :strong => 3.3, :hot => 3.2, :fast => 3.6, :beautiful => 2.0, :smooth => 2.0, :easy => 2.0, :gay => 2.5, :safe => 2.1, :majestic => 3.0, :bright => 2.6, :rounded => 2.2, :glad => 2.3, :loud => 3.3, :long => 2.5, :brave => 2.9, :kind => 2.4, :mighty => 3.9, :mobile => 3.4, :frequency => 0.015 },
21
+ "П" => { :good => 3.6, :big => 4.6, :gentle => 2.4, :feminine => 2.2, :light => 3.3, :active => 3.6, :simple => 3.5, :strong => 4.4, :hot => 2.6, :fast => 2.4, :beautiful => 3.6, :smooth => 3.5, :easy => 2.9, :gay => 3.4, :safe => 2.4, :majestic => 4.0, :bright => 4.4, :rounded => 3.5, :glad => 4.0, :loud => 4.8, :long => 4.6, :brave => 4.1, :kind => 2.2, :mighty => 4.3, :mobile => 2.5, :frequency => 0.006 },
22
+ "р" => { :good => 2.9, :big => 2.1, :gentle => 4.6, :feminine => 4.7, :light => 3.8, :active => 2.0, :simple => 3.1, :strong => 1.3, :hot => 4.0, :fast => 2.7, :beautiful => 3.0, :smooth => 4.0, :easy => 4.1, :gay => 2.6, :safe => 4.6, :majestic => 1.7, :bright => 2.1, :rounded => 4.0, :glad => 2.7, :loud => 1.8, :long => 2.5, :brave => 1.4, :kind => 4.0, :mighty => 1.5, :mobile => 2.0, :frequency => 0.024 },
23
+ "Г" => { :good => 3.6, :big => 3.9, :gentle => 2.6, :feminine => 2.8, :light => 2.9, :active => 2.9, :simple => 3.5, :strong => 3.0, :hot => 2.4, :fast => 2.4, :beautiful => 2.9, :smooth => 3.2, :easy => 2.9, :gay => 2.5, :safe => 2.3, :majestic => 3.8, :bright => 2.3, :rounded => 3.6, :glad => 2.7, :loud => 2.9, :long => 3.9, :brave => 3.4, :kind => 3.0, :mighty => 3.3, :mobile => 2.6, :frequency => 0.003 },
24
+ "ё" => { :good => 2.3, :big => 2.9, :gentle => 2.4, :feminine => 2.2, :light => 2.5, :active => 3.4, :simple => 1.8, :strong => 2.8, :hot => 2.9, :fast => 3.7, :beautiful => 2.1, :smooth => 2.5, :easy => 2.6, :gay => 2.7, :safe => 2.1, :majestic => 2.7, :bright => 2.5, :rounded => 2.5, :glad => 2.6, :loud => 2.5, :long => 2.2, :brave => 2.4, :kind => 2.2, :mighty => 2.6, :mobile => 3.3, :frequency => 0.037 },
25
+ "Ё" => { :good => 2.3, :big => 2.9, :gentle => 2.4, :feminine => 2.2, :light => 2.5, :active => 3.4, :simple => 1.8, :strong => 2.8, :hot => 2.9, :fast => 3.7, :beautiful => 2.1, :smooth => 2.5, :easy => 2.6, :gay => 2.7, :safe => 2.1, :majestic => 2.7, :bright => 2.5, :rounded => 2.5, :glad => 2.6, :loud => 2.5, :long => 2.2, :brave => 2.4, :kind => 2.2, :mighty => 2.6, :mobile => 3.3, :frequency => 0.037 },
26
+ "з" => { :good => 3.1, :big => 2.9, :gentle => 3.5, :feminine => 3.5, :light => 2.5, :active => 2.8, :simple => 3.0, :strong => 2.2, :hot => 3.6, :fast => 2.7, :beautiful => 3.2, :smooth => 4.0, :easy => 3.2, :gay => 2.4, :safe => 3.6, :majestic => 2.8, :bright => 2.5, :rounded => 3.5, :glad => 2.5, :loud => 2.5, :long => 2.9, :brave => 2.9, :kind => 3.7, :mighty => 2.9, :mobile => 3.1, :frequency => 0.013 },
27
+ "С" => { :good => 3.8, :big => 4.3, :gentle => 2.0, :feminine => 2.0, :light => 2.4, :active => 3.5, :simple => 3.8, :strong => 4.2, :hot => 3.1, :fast => 3.1, :beautiful => 3.2, :smooth => 3.5, :easy => 2.1, :gay => 3.1, :safe => 2.8, :majestic => 4.2, :bright => 3.8, :rounded => 3.0, :glad => 3.6, :loud => 4.3, :long => 3.6, :brave => 4.5, :kind => 3.1, :mighty => 4.3, :mobile => 3.0, :frequency => 0.017 },
28
+ "В" => { :good => 3.4, :big => 3.1, :gentle => 2.4, :feminine => 2.6, :light => 2.8, :active => 3.2, :simple => 3.7, :strong => 3.1, :hot => 2.5, :fast => 3.0, :beautiful => 3.1, :smooth => 3.0, :easy => 2.6, :gay => 2.7, :safe => 2.6, :majestic => 2.8, :bright => 2.7, :rounded => 3.0, :glad => 2.6, :loud => 3.0, :long => 3.9, :brave => 3.6, :kind => 2.7, :mighty => 3.1, :mobile => 2.7, :frequency => 0.011 },
29
+ "ц" => { :good => 4.0, :big => 3.7, :gentle => 3.2, :feminine => 3.3, :light => 3.5, :active => 3.4, :simple => 3.4, :strong => 3.8, :hot => 3.6, :fast => 2.3, :beautiful => 3.1, :smooth => 3.9, :easy => 3.1, :gay => 3.7, :safe => 3.3, :majestic => 3.8, :bright => 3.6, :rounded => 3.9, :glad => 3.5, :loud => 4.3, :long => 4.0, :brave => 3.7, :kind => 3.6, :mighty => 3.6, :mobile => 2.5, :frequency => 0.004 },
30
+ "Ц" => { :good => 4.0, :big => 3.7, :gentle => 3.2, :feminine => 3.3, :light => 3.5, :active => 3.4, :simple => 3.4, :strong => 3.8, :hot => 3.6, :fast => 2.3, :beautiful => 3.1, :smooth => 3.9, :easy => 3.1, :gay => 3.7, :safe => 3.3, :majestic => 3.8, :bright => 3.6, :rounded => 3.9, :glad => 3.5, :loud => 4.3, :long => 4.0, :brave => 3.7, :kind => 3.6, :mighty => 3.6, :mobile => 2.5, :frequency => 0.004 },
31
+ "э" => { :good => 2.0, :big => 1.8, :gentle => 3.4, :feminine => 3.6, :light => 2.5, :active => 3.6, :simple => 2.2, :strong => 2.3, :hot => 3.6, :fast => 3.7, :beautiful => 2.1, :smooth => 2.2, :easy => 2.7, :gay => 3.0, :safe => 2.2, :majestic => 2.1, :bright => 2.5, :rounded => 2.0, :glad => 2.6, :loud => 2.2, :long => 2.2, :brave => 2.2, :kind => 2.6, :mighty => 2.6, :mobile => 3.5, :frequency => 0.004 },
32
+ "Э" => { :good => 2.0, :big => 1.8, :gentle => 3.4, :feminine => 3.6, :light => 2.5, :active => 3.6, :simple => 2.2, :strong => 2.3, :hot => 3.6, :fast => 3.7, :beautiful => 2.1, :smooth => 2.2, :easy => 2.7, :gay => 3.0, :safe => 2.2, :majestic => 2.1, :bright => 2.5, :rounded => 2.0, :glad => 2.6, :loud => 2.2, :long => 2.2, :brave => 2.2, :kind => 2.6, :mighty => 2.6, :mobile => 3.5, :frequency => 0.001 },
33
+ "м" => { :good => 2.5, :big => 2.5, :gentle => 3.2, :feminine => 3.5, :light => 3.3, :active => 4.0, :simple => 3.1, :strong => 3.2, :hot => 3.8, :fast => 3.7, :beautiful => 3.5, :smooth => 2.8, :easy => 3.8, :gay => 3.6, :safe => 2.4, :majestic => 3.0, :bright => 3.6, :rounded => 3.1, :glad => 3.9, :loud => 3.1, :long => 3.3, :brave => 3.3, :kind => 2.7, :mighty => 2.2, :mobile => 4.1, :frequency => 0.025 },
34
+ "Б" => { :good => 3.0, :big => 3.1, :gentle => 2.6, :feminine => 2.8, :light => 2.6, :active => 3.0, :simple => 3.4, :strong => 3.5, :hot => 2.9, :fast => 2.2, :beautiful => 3.6, :smooth => 3.2, :easy => 2.5, :gay => 2.1, :safe => 2.3, :majestic => 3.2, :bright => 2.3, :rounded => 3.0, :glad => 2.8, :loud => 2.9, :long => 3.9, :brave => 3.2, :kind => 2.7, :mighty => 3.4, :mobile => 2.3, :frequency => 0.005 },
35
+ "Х" => { :good => 4.3, :big => 4.1, :gentle => 2.5, :feminine => 2.2, :light => 3.5, :active => 4.4, :simple => 3.8, :strong => 4.6, :hot => 2.4, :fast => 3.5, :beautiful => 4.1, :smooth => 3.8, :easy => 3.1, :gay => 3.4, :safe => 3.8, :majestic => 4.5, :bright => 4.3, :rounded => 3.2, :glad => 4.0, :loud => 4.7, :long => 4.0, :brave => 4.4, :kind => 3.1, :mighty => 4.5, :mobile => 3.7, :frequency => 0.001 },
36
+ "к" => { :good => 3.0, :big => 3.3, :gentle => 3.6, :feminine => 3.5, :light => 3.6, :active => 2.8, :simple => 3.4, :strong => 3.7, :hot => 3.4, :fast => 2.0, :beautiful => 3.4, :smooth => 4.2, :easy => 3.0, :gay => 3.4, :safe => 3.8, :majestic => 3.3, :bright => 4.0, :rounded => 4.4, :glad => 3.8, :loud => 3.9, :long => 4.4, :brave => 3.3, :kind => 3.2, :mighty => 3.8, :mobile => 2.0, :frequency => 0.03 },
37
+ "Т" => { :good => 3.3, :big => 4.1, :gentle => 2.2, :feminine => 2.4, :light => 3.6, :active => 3.2, :simple => 3.7, :strong => 4.2, :hot => 2.3, :fast => 2.5, :beautiful => 2.9, :smooth => 3.8, :easy => 2.9, :gay => 3.3, :safe => 3.2, :majestic => 3.4, :bright => 3.9, :rounded => 3.5, :glad => 3.8, :loud => 4.4, :long => 4.3, :brave => 4.0, :kind => 2.7, :mighty => 4.2, :mobile => 2.7, :frequency => 0.02 },
38
+ "я" => { :good => 1.8, :big => 2.1, :gentle => 2.7, :feminine => 3.6, :light => 1.9, :active => 2.6, :simple => 1.8, :strong => 1.7, :hot => 3.0, :fast => 3.2, :beautiful => 1.9, :smooth => 2.2, :easy => 2.1, :gay => 2.5, :safe => 2.1, :majestic => 2.1, :bright => 1.6, :rounded => 2.0, :glad => 1.8, :loud => 2.2, :long => 3.0, :brave => 1.6, :kind => 2.4, :mighty => 2.0, :mobile => 3.0, :frequency => 0.013 },
39
+ "Я" => { :good => 1.8, :big => 2.1, :gentle => 2.7, :feminine => 3.6, :light => 1.9, :active => 2.6, :simple => 1.8, :strong => 1.7, :hot => 3.0, :fast => 3.2, :beautiful => 1.9, :smooth => 2.2, :easy => 2.1, :gay => 2.5, :safe => 2.1, :majestic => 2.1, :bright => 1.6, :rounded => 2.0, :glad => 1.8, :loud => 2.2, :long => 3.0, :brave => 1.6, :kind => 2.4, :mighty => 2.0, :mobile => 3.0, :frequency => 0.011 },
40
+ "Н" => { :good => 2.9, :big => 3.2, :gentle => 2.0, :feminine => 2.3, :light => 2.8, :active => 3.2, :simple => 3.4, :strong => 3.4, :hot => 2.3, :fast => 3.4, :beautiful => 2.4, :smooth => 2.8, :easy => 2.6, :gay => 3.0, :safe => 2.2, :majestic => 3.2, :bright => 3.0, :rounded => 3.0, :glad => 2.8, :loud => 2.9, :long => 3.8, :brave => 3.4, :kind => 2.1, :mighty => 3.6, :mobile => 3.2, :frequency => 0.024 },
41
+ "п" => { :good => 3.5, :big => 3.4, :gentle => 3.4, :feminine => 3.6, :light => 4.0, :active => 3.4, :simple => 2.8, :strong => 4.0, :hot => 3.0, :fast => 1.9, :beautiful => 3.5, :smooth => 4.0, :easy => 3.0, :gay => 3.9, :safe => 3.8, :majestic => 3.6, :bright => 4.1, :rounded => 3.8, :glad => 3.7, :loud => 4.5, :long => 4.4, :brave => 3.7, :kind => 3.3, :mighty => 3.5, :mobile => 2.7, :frequency => 0.02 },
42
+ "ф" => { :good => 4.0, :big => 2.8, :gentle => 3.5, :feminine => 3.3, :light => 4.0, :active => 4.1, :simple => 3.3, :strong => 3.6, :hot => 3.2, :fast => 3.4, :beautiful => 3.9, :smooth => 4.1, :easy => 3.7, :gay => 3.8, :safe => 4.4, :majestic => 3.4, :bright => 4.4, :rounded => 3.6, :glad => 4.3, :loud => 4.7, :long => 3.8, :brave => 3.5, :kind => 3.8, :mighty => 3.8, :mobile => 3.9, :frequency => 0.002 },
43
+ "н" => { :good => 2.4, :big => 2.1, :gentle => 3.6, :feminine => 4.0, :light => 3.1, :active => 2.8, :simple => 2.6, :strong => 2.4, :hot => 3.4, :fast => 3.9, :beautiful => 2.6, :smooth => 2.8, :easy => 3.6, :gay => 3.1, :safe => 2.8, :majestic => 2.3, :bright => 2.7, :rounded => 3.1, :glad => 2.9, :loud => 2.6, :long => 3.3, :brave => 2.7, :kind => 3.4, :mighty => 2.4, :mobile => 3.3, :frequency => 0.04 },
44
+ "д" => { :good => 2.4, :big => 2.0, :gentle => 4.4, :feminine => 4.5, :light => 3.2, :active => 2.4, :simple => 2.6, :strong => 1.9, :hot => 3.6, :fast => 2.4, :beautiful => 2.4, :smooth => 3.4, :easy => 3.3, :gay => 2.9, :safe => 2.8, :majestic => 2.4, :bright => 2.1, :rounded => 3.5, :glad => 2.5, :loud => 2.3, :long => 3.5, :brave => 2.0, :kind => 3.1, :mighty => 2.2, :mobile => 2.2, :frequency => 0.02 },
45
+ "Л" => { :good => 1.8, :big => 3.7, :gentle => 2.0, :feminine => 1.8, :light => 2.0, :active => 2.8, :simple => 3.4, :strong => 3.4, :hot => 2.7, :fast => 3.0, :beautiful => 1.9, :smooth => 2.2, :easy => 2.7, :gay => 2.1, :safe => 1.7, :majestic => 3.0, :bright => 2.3, :rounded => 2.1, :glad => 2.1, :loud => 2.9, :long => 3.3, :brave => 2.8, :kind => 1.9, :mighty => 3.6, :mobile => 3.4, :frequency => 0.017 },
46
+ "ы" => { :good => 3.6, :big => 1.7, :gentle => 3.8, :feminine => 3.8, :light => 3.8, :active => 4.0, :simple => 3.1, :strong => 2.5, :hot => 4.0, :fast => 4.4, :beautiful => 3.7, :smooth => 2.5, :easy => 3.5, :gay => 3.7, :safe => 3.5, :majestic => 3.1, :bright => 3.6, :rounded => 2.9, :glad => 3.6, :loud => 2.4, :long => 2.2, :brave => 2.8, :kind => 2.7, :mighty => 2.5, :mobile => 3.9, :frequency => 0.01 },
47
+ "Ы" => { :good => 3.6, :big => 1.7, :gentle => 3.8, :feminine => 3.8, :light => 3.8, :active => 4.0, :simple => 3.1, :strong => 2.5, :hot => 4.0, :fast => 4.4, :beautiful => 3.7, :smooth => 2.5, :easy => 3.5, :gay => 3.7, :safe => 3.5, :majestic => 3.1, :bright => 3.6, :rounded => 2.9, :glad => 3.6, :loud => 2.4, :long => 2.2, :brave => 2.8, :kind => 2.7, :mighty => 2.5, :mobile => 3.9, :frequency => 0.006 },
48
+ "Ф" => { :good => 4.2, :big => 4.3, :gentle => 2.4, :feminine => 2.2, :light => 3.7, :active => 4.0, :simple => 3.9, :strong => 4.3, :hot => 2.4, :fast => 3.7, :beautiful => 3.4, :smooth => 3.8, :easy => 2.8, :gay => 3.2, :safe => 3.2, :majestic => 4.5, :bright => 4.3, :rounded => 3.2, :glad => 4.1, :loud => 4.4, :long => 3.9, :brave => 4.2, :kind => 3.2, :mighty => 3.9, :mobile => 4.0, :frequency => 0.001 },
49
+ "М" => { :good => 3.1, :big => 3.7, :gentle => 2.1, :feminine => 2.0, :light => 2.6, :active => 3.1, :simple => 3.6, :strong => 3.5, :hot => 2.9, :fast => 3.4, :beautiful => 3.3, :smooth => 2.6, :easy => 3.2, :gay => 2.7, :safe => 2.2, :majestic => 3.2, :bright => 3.2, :rounded => 2.8, :glad => 2.8, :loud => 3.0, :long => 4.0, :brave => 3.3, :kind => 1.9, :mighty => 3.7, :mobile => 3.7, :frequency => 0.007 },
50
+ "З" => { :good => 3.4, :big => 3.6, :gentle => 2.4, :feminine => 2.6, :light => 2.4, :active => 2.8, :simple => 3.5, :strong => 2.8, :hot => 3.0, :fast => 3.1, :beautiful => 3.2, :smooth => 3.8, :easy => 2.9, :gay => 2.4, :safe => 2.9, :majestic => 3.4, :bright => 2.2, :rounded => 3.3, :glad => 2.8, :loud => 2.7, :long => 3.4, :brave => 3.1, :kind => 3.1, :mighty => 3.4, :mobile => 3.0, :frequency => 0.002 },
51
+ "б" => { :good => 2.4, :big => 2.1, :gentle => 4.2, :feminine => 4.3, :light => 3.2, :active => 2.0, :simple => 3.0, :strong => 2.1, :hot => 3.7, :fast => 1.9, :beautiful => 2.6, :smooth => 3.2, :easy => 2.6, :gay => 2.9, :safe => 3.2, :majestic => 2.1, :bright => 2.0, :rounded => 3.4, :glad => 2.5, :loud => 2.0, :long => 3.8, :brave => 2.1, :kind => 3.3, :mighty => 1.6, :mobile => 2.0, :frequency => 0.013 },
52
+ "у" => { :good => 3.0, :big => 2.2, :gentle => 3.0, :feminine => 3.8, :light => 3.6, :active => 3.2, :simple => 1.7, :strong => 2.8, :hot => 3.6, :fast => 4.3, :beautiful => 2.9, :smooth => 1.8, :easy => 2.3, :gay => 4.0, :safe => 3.6, :majestic => 3.6, :bright => 3.7, :rounded => 2.6, :glad => 3.8, :loud => 2.3, :long => 1.9, :brave => 2.3, :kind => 3.3, :mighty => 2.9, :mobile => 4.0, :frequency => 0.017 },
53
+ "У" => { :good => 3.0, :big => 2.2, :gentle => 3.0, :feminine => 3.8, :light => 3.6, :active => 3.2, :simple => 1.7, :strong => 2.8, :hot => 3.6, :fast => 4.3, :beautiful => 2.9, :smooth => 1.8, :easy => 2.3, :gay => 4.0, :safe => 3.6, :majestic => 3.6, :bright => 3.7, :rounded => 2.6, :glad => 3.8, :loud => 2.3, :long => 1.9, :brave => 2.3, :kind => 3.3, :mighty => 2.9, :mobile => 4.0, :frequency => 0.012 },
54
+ "К" => { :good => 3.7, :big => 4.2, :gentle => 2.4, :feminine => 2.5, :light => 3.2, :active => 3.0, :simple => 3.5, :strong => 4.5, :hot => 2.2, :fast => 1.9, :beautiful => 3.4, :smooth => 3.9, :easy => 2.6, :gay => 2.5, :safe => 3.0, :majestic => 4.0, :bright => 3.8, :rounded => 3.8, :glad => 3.3, :loud => 4.4, :long => 4.4, :brave => 3.7, :kind => 3.0, :mighty => 4.0, :mobile => 2.3, :frequency => 0.003 },
55
+ "х" => { :good => 4.1, :big => 3.4, :gentle => 3.6, :feminine => 3.6, :light => 4.1, :active => 3.8, :simple => 3.1, :strong => 3.4, :hot => 3.4, :fast => 3.7, :beautiful => 3.9, :smooth => 4.2, :easy => 3.3, :gay => 3.4, :safe => 4.1, :majestic => 4.0, :bright => 4.1, :rounded => 3.9, :glad => 4.0, :loud => 4.2, :long => 3.8, :brave => 3.4, :kind => 3.5, :mighty => 3.4, :mobile => 3.7, :frequency => 0.008 },
56
+ "л" => { :good => 2.1, :big => 2.2, :gentle => 3.3, :feminine => 3.5, :light => 3.1, :active => 2.5, :simple => 3.3, :strong => 2.2, :hot => 3.6, :fast => 3.5, :beautiful => 2.3, :smooth => 2.6, :easy => 3.2, :gay => 3.0, :safe => 2.5, :majestic => 2.0, :bright => 2.4, :rounded => 3.1, :glad => 2.5, :loud => 2.3, :long => 3.4, :brave => 2.3, :kind => 3.3, :mighty => 2.1, :mobile => 3.4, :frequency => 0.02 },
57
+ "т" => { :good => 3.0, :big => 3.1, :gentle => 3.6, :feminine => 3.1, :light => 4.0, :active => 3.2, :simple => 3.2, :strong => 3.4, :hot => 2.8, :fast => 2.0, :beautiful => 3.2, :smooth => 3.8, :easy => 3.2, :gay => 3.6, :safe => 3.4, :majestic => 3.2, :bright => 3.8, :rounded => 4.1, :glad => 3.3, :loud => 4.4, :long => 4.4, :brave => 3.5, :kind => 3.4, :mighty => 3.3, :mobile => 2.5, :frequency => 0.055 },
58
+ "е" => { :good => 1.9, :big => 2.8, :gentle => 2.2, :feminine => 2.9, :light => 1.9, :active => 2.4, :simple => 1.9, :strong => 2.1, :hot => 3.0, :fast => 3.8, :beautiful => 1.7, :smooth => 2.4, :easy => 2.4, :gay => 2.5, :safe => 2.2, :majestic => 2.6, :bright => 3.6, :rounded => 2.2, :glad => 2.7, :loud => 2.9, :long => 2.5, :brave => 2.2, :kind => 2.7, :mighty => 2.3, :mobile => 3.3, :frequency => 0.05 },
59
+ "Е" => { :good => 1.9, :big => 2.8, :gentle => 2.2, :feminine => 2.9, :light => 1.9, :active => 2.4, :simple => 1.9, :strong => 2.1, :hot => 3.0, :fast => 3.8, :beautiful => 1.7, :smooth => 2.4, :easy => 2.4, :gay => 2.5, :safe => 2.2, :majestic => 2.6, :bright => 3.6, :rounded => 2.2, :glad => 2.7, :loud => 2.9, :long => 2.5, :brave => 2.2, :kind => 2.7, :mighty => 2.3, :mobile => 3.3, :frequency => 0.039 },
60
+ "ч" => { :good => 3.0, :big => 3.9, :gentle => 3.4, :feminine => 2.7, :light => 3.3, :active => 3.0, :simple => 3.4, :strong => 3.8, :hot => 1.8, :fast => 2.0, :beautiful => 3.0, :smooth => 4.6, :easy => 3.3, :gay => 2.9, :safe => 3.4, :majestic => 3.6, :bright => 3.3, :rounded => 3.8, :glad => 3.2, :loud => 4.0, :long => 4.1, :brave => 3.5, :kind => 3.3, :mighty => 3.6, :mobile => 2.5, :frequency => 0.02 },
61
+ "Ч" => { :good => 3.0, :big => 3.9, :gentle => 3.4, :feminine => 2.7, :light => 3.3, :active => 3.0, :simple => 3.4, :strong => 3.8, :hot => 1.8, :fast => 2.0, :beautiful => 3.0, :smooth => 4.6, :easy => 3.3, :gay => 2.9, :safe => 3.4, :majestic => 3.6, :bright => 3.3, :rounded => 3.8, :glad => 3.2, :loud => 4.0, :long => 4.1, :brave => 3.5, :kind => 3.3, :mighty => 3.6, :mobile => 2.5, :frequency => 0.02 },
62
+ "щ" => { :good => 3.5, :big => 3.8, :gentle => 2.7, :feminine => 2.5, :light => 3.8, :active => 4.0, :simple => 4.0, :strong => 4.2, :hot => 1.8, :fast => 3.8, :beautiful => 3.7, :smooth => 4.4, :easy => 3.4, :gay => 3.4, :safe => 4.3, :majestic => 4.4, :bright => 3.9, :rounded => 3.6, :glad => 4.2, :loud => 4.0, :long => 2.7, :brave => 4.1, :kind => 3.3, :mighty => 4.0, :mobile => 3.5, :frequency => 0.003 },
63
+ "Щ" => { :good => 3.5, :big => 3.8, :gentle => 2.7, :feminine => 2.5, :light => 3.8, :active => 4.0, :simple => 4.0, :strong => 4.2, :hot => 1.8, :fast => 3.8, :beautiful => 3.7, :smooth => 4.4, :easy => 3.4, :gay => 3.4, :safe => 4.3, :majestic => 4.4, :bright => 3.9, :rounded => 3.6, :glad => 4.2, :loud => 4.0, :long => 2.7, :brave => 4.1, :kind => 3.3, :mighty => 4.0, :mobile => 3.5, :frequency => 0.003 },
64
+ "о" => { :good => 1.6, :big => 1.3, :gentle => 3.2, :feminine => 3.7, :light => 2.2, :active => 2.2, :simple => 1.2, :strong => 1.7, :hot => 3.7, :fast => 3.6, :beautiful => 1.9, :smooth => 1.5, :easy => 2.5, :gay => 2.9, :safe => 2.8, :majestic => 1.6, :bright => 1.8, :rounded => 1.4, :glad => 2.7, :loud => 1.4, :long => 1.7, :brave => 1.8, :kind => 2.7, :mighty => 1.7, :mobile => 2.7, :frequency => 0.067 },
65
+ "О" => { :good => 1.6, :big => 1.3, :gentle => 3.2, :feminine => 3.7, :light => 2.2, :active => 2.2, :simple => 1.2, :strong => 1.7, :hot => 3.7, :fast => 3.6, :beautiful => 1.9, :smooth => 1.5, :easy => 2.5, :gay => 2.9, :safe => 2.8, :majestic => 1.6, :bright => 1.8, :rounded => 1.4, :glad => 2.7, :loud => 1.4, :long => 1.7, :brave => 1.8, :kind => 2.7, :mighty => 1.7, :mobile => 2.7, :frequency => 0.037 },
66
+ }
67
+
68
+ ANTONYMES = {
69
+ :good => ['хороший', 'плохой'], :big => ['большой', 'маленький'],
70
+ :gentle => ['нежный', 'грубый'], :feminine => ['женственный', 'мужественный'],
71
+ :light => ['светлый', 'тёмный'], :active => ['активный', 'пассивный'],
72
+ :simple => ['простой', 'сложный'], :strong => ['сильный', 'слабый'],
73
+ :hot => ['горячий', 'холодный'], :fast => ['быстрый', 'медленный'],
74
+ :beautiful => ['красивый', 'отталкивающий'], :smooth => ['гладкий', 'шероховатый'],
75
+ :easy => ['лёгкий', 'тяжёлый'], :gay => ['весёлый', 'грустный'],
76
+ :safe => ['безопасный', 'страшный'], :majestic => ['величественный', 'низменный'],
77
+ :bright => ['яркий', 'тусклый'], :rounded => ['округлый', 'угловатый'],
78
+ :glad => ['радостный', 'печальный'], :loud => ['громкий', 'тихий'],
79
+ :long => ['длинный', 'короткий'], :brave => ['храбрый', 'трусливый'],
80
+ :kind => ['добрый', 'злой'], :mighty => ['могучий', 'хилый'],
81
+ :mobile => ['подвижный', 'медлительный']
82
+ }
83
+ end
data/lib/phonos.rb ADDED
@@ -0,0 +1,17 @@
1
+ # encoding: utf-8
2
+
3
+ require 'lib/string_crutch'
4
+
5
+ begin
6
+ require 'unicode'
7
+ require 'active_support/all'
8
+ require 'yaml'
9
+ rescue LoadError
10
+ require 'rubygems'
11
+ retry
12
+ end
13
+
14
+ module Phonos
15
+ require 'lib/phonos/analyzer'
16
+ require 'lib/phonos/language'
17
+ end
@@ -0,0 +1,17 @@
1
+ $KCODE = 'u' if RUBY_VERSION < '1.9'
2
+
3
+ module StringCrutch
4
+ class << self
5
+ def count(str, char)
6
+ chars(str).select { |c| c == char }.size
7
+ end
8
+
9
+ def size(str)
10
+ chars(str).size
11
+ end
12
+
13
+ def chars(str)
14
+ str.scan(/./mu)
15
+ end
16
+ end
17
+ end
data/phonos.gemspec ADDED
@@ -0,0 +1,64 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{phonos}
8
+ s.version = "1.2.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Lumren Randir"]
12
+ s.date = %q{2010-08-19}
13
+ s.description = %q{Phonos, the Phonosemantics Analyser}
14
+ s.email = %q{lumrandir@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".gitignore",
22
+ "LICENSE",
23
+ "README.rdoc",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "lib/phonos.rb",
27
+ "lib/phonos/analyzer.rb",
28
+ "lib/phonos/language.rb",
29
+ "lib/string_crutch.rb",
30
+ "phonos.gemspec",
31
+ "share/ru.yaml",
32
+ "test/helper.rb",
33
+ "test/test_phonos.rb"
34
+ ]
35
+ s.homepage = %q{http://feeltoday.ru/}
36
+ s.rdoc_options = ["--charset=UTF-8"]
37
+ s.require_paths = ["lib"]
38
+ s.rubygems_version = %q{1.3.6}
39
+ s.summary = %q{Phonos Phonosemantics Gem}
40
+ s.test_files = [
41
+ "test/test_phonos.rb",
42
+ "test/helper.rb"
43
+ ]
44
+
45
+ if s.respond_to? :specification_version then
46
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
47
+ s.specification_version = 3
48
+
49
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
50
+ s.add_development_dependency(%q<shoulda>, [">= 2.10.3"])
51
+ s.add_runtime_dependency(%q<activesupport>, [">= 0"])
52
+ s.add_runtime_dependency(%q<i18n>, [">= 0"])
53
+ else
54
+ s.add_dependency(%q<shoulda>, [">= 2.10.3"])
55
+ s.add_dependency(%q<activesupport>, [">= 0"])
56
+ s.add_dependency(%q<i18n>, [">= 0"])
57
+ end
58
+ else
59
+ s.add_dependency(%q<shoulda>, [">= 2.10.3"])
60
+ s.add_dependency(%q<activesupport>, [">= 0"])
61
+ s.add_dependency(%q<i18n>, [">= 0"])
62
+ end
63
+ end
64
+