pronounce 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,33 @@
1
+ module Pronounce
2
+ CMUDICT_VERSION = '0.7a'
3
+ DATA_DIR = File.dirname(__FILE__) + '/../data'
4
+
5
+ class << self
6
+ def how_do_i_pronounce(word)
7
+ @pronouncation_dictionary ||= build_pronuciation_dictionary
8
+ @pronouncation_dictionary[word.downcase]
9
+ end
10
+
11
+ def symbols
12
+ File.read("#{DATA_DIR}/cmudict/cmudict.#{CMUDICT_VERSION}.symbols").
13
+ split("\r\n")
14
+ end
15
+
16
+ private
17
+
18
+ def build_pronuciation_dictionary
19
+ dictionary = {}
20
+
21
+ File.open("#{DATA_DIR}/cmudict/cmudict.#{CMUDICT_VERSION}") do |f|
22
+ f.readlines.each do |line|
23
+ word, *pron = line.strip.split(' ')
24
+ next unless word && !word.empty? && !word[/[^A-Z]+/]
25
+ dictionary[word.downcase] = pron
26
+ end
27
+ end
28
+
29
+ dictionary
30
+ end
31
+
32
+ end
33
+ end
metadata ADDED
@@ -0,0 +1,104 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pronounce
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Joseph Wilk
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2012-09-06 00:00:00 +01:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rspec
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ type: :development
31
+ version_requirements: *id001
32
+ description: Helping provide useful information about words for machines
33
+ email:
34
+ - joe@josephwilk.net
35
+ executables: []
36
+
37
+ extensions: []
38
+
39
+ extra_rdoc_files: []
40
+
41
+ files:
42
+ - lib/pronounce.rb
43
+ - data/beep/ACKNOWLEDGEMENTS
44
+ - data/beep/addparan
45
+ - data/beep/ANNOUNCE-1.0
46
+ - data/beep/beep-1.0
47
+ - data/beep/case.txt
48
+ - data/beep/lexicode.doc
49
+ - data/beep/phoncode.doc
50
+ - data/beep/phone45.tab
51
+ - data/beep/README
52
+ - data/beep/sayTimit.doc
53
+ - data/beep/sayTimit.pl
54
+ - data/cmudict/00README_FIRST.txt
55
+ - data/cmudict/cmudict.0.6d
56
+ - data/cmudict/cmudict.0.7a
57
+ - data/cmudict/cmudict.0.7a.phones
58
+ - data/cmudict/cmudict.0.7a.symbols
59
+ - data/cmudict/README.developer
60
+ - data/cmudict/README.old
61
+ - data/cmudict/README.weide
62
+ - data/cmudict/scripts/CompileDictionary.sh
63
+ - data/cmudict/scripts/make_baseform.pl
64
+ - data/cmudict/scripts/README.txt
65
+ - data/cmudict/scripts/sort_cmudict.pl
66
+ - data/cmudict/scripts/test_cmudict.pl
67
+ - data/cmudict/scripts/test_dict.pl
68
+ - data/cmudict/sphinxdict/cmudict.0.7a_SPHINX_40
69
+ - data/cmudict/sphinxdict/cmudict_SPHINX_40
70
+ - data/cmudict/sphinxdict/README.txt
71
+ - data/cmudict/sphinxdict/SphinxPhones_40
72
+ - README.md
73
+ has_rdoc: true
74
+ homepage: http://github.com/josephwilk/pronounce
75
+ licenses: []
76
+
77
+ post_install_message:
78
+ rdoc_options: []
79
+
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ segments:
87
+ - 0
88
+ version: "0"
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ segments:
94
+ - 0
95
+ version: "0"
96
+ requirements: []
97
+
98
+ rubyforge_project:
99
+ rubygems_version: 1.3.6
100
+ signing_key:
101
+ specification_version: 3
102
+ summary: Helping provide useful information about words for machines
103
+ test_files: []
104
+