phoneme 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dea0d754d88bb4dca156ce2643c451c8190b16f1
4
- data.tar.gz: 2a1c408e7e0777e1c26b06d1366262ded5007291
3
+ metadata.gz: d58b1f0a00cfcd77246e62a9e96eda6d6a859645
4
+ data.tar.gz: 1d8d6d3f1e2592da2227a8c26c7f0043bd906495
5
5
  SHA512:
6
- metadata.gz: 50bcf8090102991fc205d5ff43d2c5ec9ed0930e672d6e5a8672a37eef2d511aac0ba5adeedf1e015fe7a3a75778b5861d558623b51a793256c557c228bf3d2c
7
- data.tar.gz: fe8127a46f6d4e111b0ab44c36b1b672b3d00fe8954c54348336ac12b90fd64fe4f9416a03a952c1a7e3c8338efe5180412387a3e7cce77b264f7803b76f49bd
6
+ metadata.gz: 487ecf9cd3149ad360b3cbdd0496d6cf316fbcfda7b2505be7763390719cdc1c557ef2e963ad59b022118a6fa88989163ab2abd6249b2ca0cde3aaf576785d6e
7
+ data.tar.gz: d39a77084fd5b67487a256af43ddb816762c84f9b72ddef47f21a5ca8a90657b30f0e934194322e78d0c507dcea59a0ca313eacd31060466288e174291beb3a1
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/phoneme.rb CHANGED
@@ -18,32 +18,32 @@ class Phoneme
18
18
  @a = [
19
19
  {ey: /^a.[eo]/, ae: /^a.*/ },
20
20
  :b,
21
- {k: /^ca/, ch: /^(ch)/,s: /^ce|^c.*/},
21
+ {k: /^ca|^co/, ch: /^(ch)/,s: /^ce|^c.*/},
22
22
  :d,
23
23
  {iy: /^ee|^e$/, eh: /^e.*/},
24
24
  :f,
25
- {jh: /^ge/, g: /^g.*/},
26
- {hh: /^h./},
25
+ {jh: /^ge/, :'' => /^(gh)/, g: /^g.*/},
26
+ {hh: /^h.*/},
27
27
  {ay: /^i$|^ie|^igh|^i.e/, ih: /^i.*/},
28
28
  :jh,
29
29
  {n: /^kn/, k: /^k.*/},
30
30
  :l,
31
31
  {m: /^(me)|^m/},
32
32
  {ng: /^ng/, n: /^n.*/},
33
- {ow: /^oa|^o$/, oy: /^oy/, aw: /^(ou)/, ah: /^om|^pl/},
33
+ {ow: /^oa|^o$/, oy: /^oy/, uh: /^(oo)/, ao: /^(ou)/, aw: /^(o[uw])/, ah: /^om|^pl/, aa: /^(o).*/},
34
34
  {p: /^p.*/},
35
35
  :q,
36
36
  :r,
37
37
  {sh: /^(sh)/, s: /^s.*/},
38
38
  {th: /^(th)/, t: /^t.*/},
39
- {uw: /^(u)b|^(u)de/, er: /^(ur)/, uh: /^u.*/},
39
+ {uw: /^(u)b|^(u)de/, er: /^(ur)/, ah: /^u.*/},
40
40
  :v,
41
41
  {w: /^(wh)|^w.*/},
42
42
  {z: /^xy/, e: /^x.*/},
43
43
  {zh: /^zu/, z: /^z.*/}
44
44
  ]
45
45
 
46
- @to_s = phonemize(s).sub(/(e|iy) $/,'').rstrip.upcase
46
+ @to_s = phonemize(s).sub(/e$/,'').sub(/([ld]) iy$/,'\1').rstrip.upcase
47
47
  end
48
48
 
49
49
  private
@@ -59,7 +59,7 @@ class Phoneme
59
59
  if x.is_a? Symbol then
60
60
 
61
61
  found = s2[0] == x.to_s
62
- r3 = x.to_s + ' '
62
+ r3 = x.to_s
63
63
  found
64
64
 
65
65
  elsif x.is_a? Hash
@@ -67,7 +67,7 @@ class Phoneme
67
67
  x.detect do |sym,regex|
68
68
 
69
69
  found = s2[regex]
70
- r3 = found ? sym.to_s + ' ' : ''
70
+ r3 = found ? sym.to_s : ''
71
71
  found
72
72
  end
73
73
 
@@ -78,11 +78,13 @@ class Phoneme
78
78
 
79
79
  new_s = $1 ? s[2..-1] : s[1..-1]
80
80
 
81
- if new_s.length > 0 then
82
- new_sym = phonemize(new_s)
83
- r3 + new_sym
81
+ if new_s.length > 0 then
82
+
83
+ new_sym = phonemize(new_s)
84
+ !r3.empty? ? r3 + ' ' + new_sym : new_sym
84
85
  else
85
- r3
86
+
87
+ r3.strip
86
88
  end
87
89
 
88
90
  end
@@ -95,5 +97,4 @@ if __FILE__ == $0 then
95
97
 
96
98
  puts Phoneme.new(ARGV[0].first).to_s
97
99
 
98
- end
99
-
100
+ end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phoneme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  SQk8Kbde1FTCm9onCpo6/RPLxcaiyl97opYx0Cje7Vs/TIygD197+rC4MkSKY9oo
32
32
  IkOAXDyB+OV+RA==
33
33
  -----END CERTIFICATE-----
34
- date: 2015-07-29 00:00:00.000000000 Z
34
+ date: 2015-07-31 00:00:00.000000000 Z
35
35
  dependencies: []
36
36
  description:
37
37
  email: james@r0bertson.co.uk
metadata.gz.sig CHANGED
Binary file