linguistics 1.0.9 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.gemtest +0 -0
  3. data/ChangeLog +849 -342
  4. data/History.rdoc +11 -0
  5. data/LICENSE +9 -9
  6. data/Manifest.txt +44 -0
  7. data/README.rdoc +226 -0
  8. data/Rakefile +32 -349
  9. data/examples/endocs.rb +272 -0
  10. data/examples/generalize_sentence.rb +2 -1
  11. data/examples/klingon.rb +22 -0
  12. data/lib/linguistics.rb +130 -292
  13. data/lib/linguistics/en.rb +337 -1628
  14. data/lib/linguistics/en/articles.rb +138 -0
  15. data/lib/linguistics/en/conjugation.rb +2245 -0
  16. data/lib/linguistics/en/conjunctions.rb +202 -0
  17. data/lib/linguistics/en/{infinitive.rb → infinitives.rb} +41 -55
  18. data/lib/linguistics/en/linkparser.rb +41 -49
  19. data/lib/linguistics/en/numbers.rb +483 -0
  20. data/lib/linguistics/en/participles.rb +33 -0
  21. data/lib/linguistics/en/pluralization.rb +810 -0
  22. data/lib/linguistics/en/stemmer.rb +75 -0
  23. data/lib/linguistics/en/titlecase.rb +121 -0
  24. data/lib/linguistics/en/wordnet.rb +63 -97
  25. data/lib/linguistics/inflector.rb +89 -0
  26. data/lib/linguistics/iso639.rb +534 -448
  27. data/lib/linguistics/languagebehavior.rb +36 -0
  28. data/lib/linguistics/monkeypatches.rb +42 -0
  29. data/spec/lib/constants.rb +15 -0
  30. data/spec/lib/helpers.rb +38 -0
  31. data/spec/linguistics/en/articles_spec.rb +797 -0
  32. data/spec/linguistics/en/conjugation_spec.rb +2083 -0
  33. data/spec/linguistics/en/conjunctions_spec.rb +154 -0
  34. data/spec/linguistics/en/infinitives_spec.rb +518 -0
  35. data/spec/linguistics/en/linkparser_spec.rb +66 -0
  36. data/spec/linguistics/en/numbers_spec.rb +1295 -0
  37. data/spec/linguistics/en/participles_spec.rb +55 -0
  38. data/spec/linguistics/en/pluralization_spec.rb +4636 -0
  39. data/spec/linguistics/en/stemmer_spec.rb +72 -0
  40. data/spec/linguistics/en/titlecase_spec.rb +841 -0
  41. data/spec/linguistics/en/wordnet_spec.rb +85 -0
  42. data/spec/linguistics/en_spec.rb +45 -167
  43. data/spec/linguistics/inflector_spec.rb +40 -0
  44. data/spec/linguistics/iso639_spec.rb +49 -53
  45. data/spec/linguistics/monkeypatches_spec.rb +40 -0
  46. data/spec/linguistics_spec.rb +46 -76
  47. metadata +241 -113
  48. metadata.gz.sig +0 -0
  49. data/README +0 -166
  50. data/README.english +0 -245
  51. data/rake/191_compat.rb +0 -26
  52. data/rake/dependencies.rb +0 -76
  53. data/rake/documentation.rb +0 -123
  54. data/rake/helpers.rb +0 -502
  55. data/rake/hg.rb +0 -318
  56. data/rake/manual.rb +0 -787
  57. data/rake/packaging.rb +0 -129
  58. data/rake/publishing.rb +0 -341
  59. data/rake/style.rb +0 -62
  60. data/rake/svn.rb +0 -668
  61. data/rake/testing.rb +0 -152
  62. data/rake/verifytask.rb +0 -64
  63. data/tests/en/infinitive.tests.rb +0 -207
  64. data/tests/en/inflect.tests.rb +0 -1389
  65. data/tests/en/lafcadio.tests.rb +0 -77
  66. data/tests/en/linkparser.tests.rb +0 -42
  67. data/tests/en/lprintf.tests.rb +0 -77
  68. data/tests/en/titlecase.tests.rb +0 -73
  69. data/tests/en/wordnet.tests.rb +0 -95
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rspec'
4
+
5
+ require 'linguistics'
6
+ require 'linguistics/iso639'
7
+
8
+
9
+ # This is a RSpec 2 shared behavior for language plugins. You can use this to be
10
+ # sure that your language plugin conforms to the API expected by Linguistics. You'll
11
+ # probably want to use it something like this:
12
+ #
13
+ # require 'linguistics/languagebehavior'
14
+ #
15
+ # describe Linguistics::KL do
16
+ #
17
+ # it_should_behave_like "A Linguistics language module"
18
+ #
19
+ # # ... any other specs for your module
20
+ #
21
+ # end
22
+
23
+ shared_examples_for "a Linguistics language module" do
24
+
25
+ let( :language_module ) do
26
+ described_class
27
+ end
28
+
29
+
30
+ it "registers itself with the Linguistics module when required" do
31
+ Linguistics.languages.values.should include( language_module )
32
+ end
33
+
34
+ end
35
+
36
+
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env ruby -w
2
+
3
+ module Linguistics
4
+
5
+ ### A collection of extensions that get added to Array.
6
+ module ArrayExtensions
7
+
8
+ ### Returns a new Array that has had a new member inserted between all of
9
+ ### the current ones. The value used is the given +value+ argument unless a
10
+ ### block is given, in which case the block is called once for each pair of
11
+ ### the Array, and the return value is used as the separator.
12
+ def separate( *args, &block )
13
+ ary = self.dup
14
+ ary.separate!( *args, &block )
15
+ return ary
16
+ end
17
+
18
+ ### The same as #separate, but modifies the Array in place.
19
+ def separate!( *args )
20
+ raise LocalJumpError, "no block given for no-arg #separate!" if
21
+ args.empty? && !block_given?
22
+ value = args.first
23
+
24
+ (1..( (self.length * 2) - 2 )).step(2) do |i|
25
+ if block_given?
26
+ self.insert( i, yield(self[i-1,2]) )
27
+ else
28
+ self.insert( i, value )
29
+ end
30
+ end
31
+ self
32
+ end
33
+
34
+ end # module ArrayExtensions
35
+
36
+ end # module Linguistics
37
+
38
+ ### Extend Array
39
+ class Array
40
+ include Linguistics::ArrayExtensions
41
+ end
42
+
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'linguistics'
4
+
5
+
6
+ ### A collection of constants used in testing
7
+ module Linguistics::TestConstants # :nodoc:all
8
+
9
+ TEST_ARRAY = %w{stone stick hammer stone lantern}
10
+ TEST_STRING = "banner"
11
+ TEST_NUMBER = 5
12
+
13
+ end
14
+
15
+
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/ruby
2
+ # coding: utf-8
3
+
4
+ BEGIN {
5
+ require 'pathname'
6
+ basedir = Pathname.new( __FILE__ ).dirname.parent
7
+
8
+ libdir = basedir + "lib"
9
+
10
+ $LOAD_PATH.unshift( libdir.to_s ) unless $LOAD_PATH.include?( libdir.to_s )
11
+ }
12
+
13
+ # SimpleCov test coverage reporting; enable this using the :coverage rake task
14
+ if ENV['COVERAGE']
15
+ $stderr.puts "\n\n>>> Enabling coverage report.\n\n"
16
+ require 'simplecov'
17
+ SimpleCov.start do
18
+ add_filter 'spec'
19
+ add_group "Needing tests" do |file|
20
+ file.covered_percent < 90
21
+ end
22
+ end
23
+ end
24
+
25
+ require 'linguistics'
26
+
27
+ require 'rspec'
28
+ require 'spec/lib/constants'
29
+ require 'loggability/spechelpers'
30
+
31
+ ### Mock with RSpec
32
+ RSpec.configure do |c|
33
+ c.mock_with( :rspec )
34
+ c.include( Loggability::SpecHelpers )
35
+ end
36
+
37
+ # vim: set nosta noet ts=4 sw=4:
38
+
@@ -0,0 +1,797 @@
1
+ #!/usr/bin/env rspec -cfd
2
+
3
+ BEGIN {
4
+ require 'pathname'
5
+ basedir = Pathname.new( __FILE__ ).dirname.parent.parent.parent
6
+
7
+ libdir = basedir + "lib"
8
+
9
+ $LOAD_PATH.unshift( basedir.to_s ) unless $LOAD_PATH.include?( basedir.to_s )
10
+ $LOAD_PATH.unshift( libdir.to_s ) unless $LOAD_PATH.include?( libdir.to_s )
11
+ }
12
+
13
+ require 'rspec'
14
+ require 'spec/lib/helpers'
15
+
16
+ require 'linguistics'
17
+ require 'linguistics/en'
18
+ require 'linguistics/en/articles'
19
+
20
+
21
+ describe Linguistics::EN::Articles do
22
+
23
+ before( :all ) do
24
+ setup_logging()
25
+ Linguistics.use( :en )
26
+ end
27
+
28
+ after( :all ) do
29
+ reset_logging()
30
+ end
31
+
32
+
33
+ it "uses 'an' as the indefinite article for 'A.B.C'" do
34
+ "A.B.C".en.a.should == "an A.B.C"
35
+ end
36
+
37
+ it "uses 'an' as the indefinite article for 'AI'" do
38
+ "AI".en.a.should == "an AI"
39
+ end
40
+
41
+ it "uses 'an' as the indefinite article for 'AGE'" do
42
+ "AGE".en.a.should == "an AGE"
43
+ end
44
+
45
+ it "uses 'an' as the indefinite article for 'agendum'" do
46
+ "agendum".en.a.should == "an agendum"
47
+ end
48
+
49
+ it "uses 'an' as the indefinite article for 'aide-de-camp'" do
50
+ "aide-de-camp".en.a.should == "an aide-de-camp"
51
+ end
52
+
53
+ it "uses 'an' as the indefinite article for 'albino'" do
54
+ "albino".en.a.should == "an albino"
55
+ end
56
+
57
+ it "uses 'a' as the indefinite article for 'B.L.T. sandwich'" do
58
+ "B.L.T. sandwich".en.a.should == "a B.L.T. sandwich"
59
+ end
60
+
61
+ it "uses 'a' as the indefinite article for 'BMW'" do
62
+ "BMW".en.a.should == "a BMW"
63
+ end
64
+
65
+ it "uses 'a' as the indefinite article for 'BLANK'" do
66
+ "BLANK".en.a.should == "a BLANK"
67
+ end
68
+
69
+ it "uses 'a' as the indefinite article for 'bacterium'" do
70
+ "bacterium".en.a.should == "a bacterium"
71
+ end
72
+
73
+ it "uses 'a' as the indefinite article for 'Burmese restaurant'" do
74
+ "Burmese restaurant".en.a.should == "a Burmese restaurant"
75
+ end
76
+
77
+ it "uses 'a' as the indefinite article for 'C.O.'" do
78
+ "C.O.".en.a.should == "a C.O."
79
+ end
80
+
81
+ it "uses 'a' as the indefinite article for 'CCD'" do
82
+ "CCD".en.a.should == "a CCD"
83
+ end
84
+
85
+ it "uses 'a' as the indefinite article for 'COLON'" do
86
+ "COLON".en.a.should == "a COLON"
87
+ end
88
+
89
+ it "uses 'a' as the indefinite article for 'cameo'" do
90
+ "cameo".en.a.should == "a cameo"
91
+ end
92
+
93
+ it "uses 'a' as the indefinite article for 'CAPITAL'" do
94
+ "CAPITAL".en.a.should == "a CAPITAL"
95
+ end
96
+
97
+ it "uses 'a' as the indefinite article for 'D.S.M.'" do
98
+ "D.S.M.".en.a.should == "a D.S.M."
99
+ end
100
+
101
+ it "uses 'a' as the indefinite article for 'DNR'" do
102
+ "DNR".en.a.should == "a DNR"
103
+ end
104
+
105
+ it "uses 'a' as the indefinite article for 'DINNER'" do
106
+ "DINNER".en.a.should == "a DINNER"
107
+ end
108
+
109
+ it "uses 'a' as the indefinite article for 'dynamo'" do
110
+ "dynamo".en.a.should == "a dynamo"
111
+ end
112
+
113
+ it "uses 'an' as the indefinite article for 'E.K.G.'" do
114
+ "E.K.G.".en.a.should == "an E.K.G."
115
+ end
116
+
117
+ it "uses 'an' as the indefinite article for 'ECG'" do
118
+ "ECG".en.a.should == "an ECG"
119
+ end
120
+
121
+ it "uses 'an' as the indefinite article for 'EGG'" do
122
+ "EGG".en.a.should == "an EGG"
123
+ end
124
+
125
+ it "uses 'an' as the indefinite article for 'embryo'" do
126
+ "embryo".en.a.should == "an embryo"
127
+ end
128
+
129
+ it "uses 'an' as the indefinite article for 'erratum'" do
130
+ "erratum".en.a.should == "an erratum"
131
+ end
132
+
133
+ it "uses 'a' as the indefinite article for 'eucalyptus'" do
134
+ "eucalyptus".en.a.should == "a eucalyptus"
135
+ end
136
+
137
+ it "uses 'an' as the indefinite article for 'Euler number'" do
138
+ "Euler number".en.a.should == "an Euler number"
139
+ end
140
+
141
+ it "uses 'a' as the indefinite article for 'eulogy'" do
142
+ "eulogy".en.a.should == "a eulogy"
143
+ end
144
+
145
+ it "uses 'a' as the indefinite article for 'euphemism'" do
146
+ "euphemism".en.a.should == "a euphemism"
147
+ end
148
+
149
+ it "uses 'a' as the indefinite article for 'euphoria'" do
150
+ "euphoria".en.a.should == "a euphoria"
151
+ end
152
+
153
+ it "uses 'a' as the indefinite article for 'ewe'" do
154
+ "ewe".en.a.should == "a ewe"
155
+ end
156
+
157
+ it "uses 'a' as the indefinite article for 'ewer'" do
158
+ "ewer".en.a.should == "a ewer"
159
+ end
160
+
161
+ it "uses 'an' as the indefinite article for 'extremum'" do
162
+ "extremum".en.a.should == "an extremum"
163
+ end
164
+
165
+ it "uses 'an' as the indefinite article for 'eye'" do
166
+ "eye".en.a.should == "an eye"
167
+ end
168
+
169
+ it "uses 'an' as the indefinite article for 'F.B.I. agent'" do
170
+ "F.B.I. agent".en.a.should == "an F.B.I. agent"
171
+ end
172
+
173
+ it "uses 'an' as the indefinite article for 'FSM'" do
174
+ "FSM".en.a.should == "an FSM"
175
+ end
176
+
177
+ it "uses 'a' as the indefinite article for 'FACT'" do
178
+ "FACT".en.a.should == "a FACT"
179
+ end
180
+
181
+ it "uses 'a' as the indefinite article for 'FAQ'" do
182
+ "FAQ".en.a.should == "a FAQ"
183
+ end
184
+
185
+ it "uses 'an' as the indefinite article for 'F.A.Q.'" do
186
+ "F.A.Q.".en.a.should == "an F.A.Q."
187
+ end
188
+
189
+ it "uses 'a' as the indefinite article for 'fish'" do
190
+ "fish".en.a.should == "a fish"
191
+ end
192
+
193
+ it "uses 'a' as the indefinite article for 'G-string'" do
194
+ "G-string".en.a.should == "a G-string"
195
+ end
196
+
197
+ it "uses 'a' as the indefinite article for 'GSM phone'" do
198
+ "GSM phone".en.a.should == "a GSM phone"
199
+ end
200
+
201
+ it "uses 'a' as the indefinite article for 'GOD'" do
202
+ "GOD".en.a.should == "a GOD"
203
+ end
204
+
205
+ it "uses 'a' as the indefinite article for 'genus'" do
206
+ "genus".en.a.should == "a genus"
207
+ end
208
+
209
+ it "uses 'a' as the indefinite article for 'Governor General'" do
210
+ "Governor General".en.a.should == "a Governor General"
211
+ end
212
+
213
+ it "uses 'an' as the indefinite article for 'H-Bomb'" do
214
+ "H-Bomb".en.a.should == "an H-Bomb"
215
+ end
216
+
217
+ it "uses 'an' as the indefinite article for 'H.M.S Ark Royal'" do
218
+ "H.M.S Ark Royal".en.a.should == "an H.M.S Ark Royal"
219
+ end
220
+
221
+ it "uses 'an' as the indefinite article for 'HSL colour space'" do
222
+ "HSL colour space".en.a.should == "an HSL colour space"
223
+ end
224
+
225
+ it "uses 'a' as the indefinite article for 'HAL 9000'" do
226
+ "HAL 9000".en.a.should == "a HAL 9000"
227
+ end
228
+
229
+ it "uses 'an' as the indefinite article for 'H.A.L. 9000'" do
230
+ "H.A.L. 9000".en.a.should == "an H.A.L. 9000"
231
+ end
232
+
233
+ it "uses 'a' as the indefinite article for 'has-been'" do
234
+ "has-been".en.a.should == "a has-been"
235
+ end
236
+
237
+ it "uses 'a' as the indefinite article for 'height'" do
238
+ "height".en.a.should == "a height"
239
+ end
240
+
241
+ it "uses 'an' as the indefinite article for 'heir'" do
242
+ "heir".en.a.should == "an heir"
243
+ end
244
+
245
+ it "uses 'a' as the indefinite article for 'honed blade'" do
246
+ "honed blade".en.a.should == "a honed blade"
247
+ end
248
+
249
+ it "uses 'an' as the indefinite article for 'honest man'" do
250
+ "honest man".en.a.should == "an honest man"
251
+ end
252
+
253
+ it "uses 'a' as the indefinite article for 'honeymoon'" do
254
+ "honeymoon".en.a.should == "a honeymoon"
255
+ end
256
+
257
+ it "uses 'an' as the indefinite article for 'honorarium'" do
258
+ "honorarium".en.a.should == "an honorarium"
259
+ end
260
+
261
+ it "uses 'an' as the indefinite article for 'honorary degree'" do
262
+ "honorary degree".en.a.should == "an honorary degree"
263
+ end
264
+
265
+ it "uses 'an' as the indefinite article for 'honoree'" do
266
+ "honoree".en.a.should == "an honoree"
267
+ end
268
+
269
+ it "uses 'an' as the indefinite article for 'honorific'" do
270
+ "honorific".en.a.should == "an honorific"
271
+ end
272
+
273
+ it "uses 'a' as the indefinite article for 'Hough transform'" do
274
+ "Hough transform".en.a.should == "a Hough transform"
275
+ end
276
+
277
+ it "uses 'a' as the indefinite article for 'hound'" do
278
+ "hound".en.a.should == "a hound"
279
+ end
280
+
281
+ it "uses 'an' as the indefinite article for 'hour'" do
282
+ "hour".en.a.should == "an hour"
283
+ end
284
+
285
+ it "uses 'an' as the indefinite article for 'hourglass'" do
286
+ "hourglass".en.a.should == "an hourglass"
287
+ end
288
+
289
+ it "uses 'a' as the indefinite article for 'houri'" do
290
+ "houri".en.a.should == "a houri"
291
+ end
292
+
293
+ it "uses 'a' as the indefinite article for 'house'" do
294
+ "house".en.a.should == "a house"
295
+ end
296
+
297
+ it "uses 'an' as the indefinite article for 'I.O.U.'" do
298
+ "I.O.U.".en.a.should == "an I.O.U."
299
+ end
300
+
301
+ it "uses 'an' as the indefinite article for 'IQ'" do
302
+ "IQ".en.a.should == "an IQ"
303
+ end
304
+
305
+ it "uses 'an' as the indefinite article for 'IDEA'" do
306
+ "IDEA".en.a.should == "an IDEA"
307
+ end
308
+
309
+ it "uses 'an' as the indefinite article for 'inferno'" do
310
+ "inferno".en.a.should == "an inferno"
311
+ end
312
+
313
+ it "uses 'an' as the indefinite article for 'Inspector General'" do
314
+ "Inspector General".en.a.should == "an Inspector General"
315
+ end
316
+
317
+ it "uses 'a' as the indefinite article for 'jumbo'" do
318
+ "jumbo".en.a.should == "a jumbo"
319
+ end
320
+
321
+ it "uses 'a' as the indefinite article for 'knife'" do
322
+ "knife".en.a.should == "a knife"
323
+ end
324
+
325
+ it "uses 'an' as the indefinite article for 'L.E.D.'" do
326
+ "L.E.D.".en.a.should == "an L.E.D."
327
+ end
328
+
329
+ it "uses 'a' as the indefinite article for 'LED'" do
330
+ "LED".en.a.should == "a LED"
331
+ end
332
+
333
+ it "uses 'an' as the indefinite article for 'LCD'" do
334
+ "LCD".en.a.should == "an LCD"
335
+ end
336
+
337
+ it "uses 'a' as the indefinite article for 'lady in waiting'" do
338
+ "lady in waiting".en.a.should == "a lady in waiting"
339
+ end
340
+
341
+ it "uses 'a' as the indefinite article for 'leaf'" do
342
+ "leaf".en.a.should == "a leaf"
343
+ end
344
+
345
+ it "uses 'an' as the indefinite article for 'M.I.A.'" do
346
+ "M.I.A.".en.a.should == "an M.I.A."
347
+ end
348
+
349
+ it "uses 'a' as the indefinite article for 'MIASMA'" do
350
+ "MIASMA".en.a.should == "a MIASMA"
351
+ end
352
+
353
+ it "uses 'an' as the indefinite article for 'MTV channel'" do
354
+ "MTV channel".en.a.should == "an MTV channel"
355
+ end
356
+
357
+ it "uses 'a' as the indefinite article for 'Major General'" do
358
+ "Major General".en.a.should == "a Major General"
359
+ end
360
+
361
+ it "uses 'an' as the indefinite article for 'N.C.O.'" do
362
+ "N.C.O.".en.a.should == "an N.C.O."
363
+ end
364
+
365
+ it "uses 'an' as the indefinite article for 'NCO'" do
366
+ "NCO".en.a.should == "an NCO"
367
+ end
368
+
369
+ it "uses 'a' as the indefinite article for 'NATO country'" do
370
+ "NATO country".en.a.should == "a NATO country"
371
+ end
372
+
373
+ it "uses 'a' as the indefinite article for 'note'" do
374
+ "note".en.a.should == "a note"
375
+ end
376
+
377
+ it "uses 'an' as the indefinite article for 'O.K.'" do
378
+ "O.K.".en.a.should == "an O.K."
379
+ end
380
+
381
+ it "uses 'an' as the indefinite article for 'OK'" do
382
+ "OK".en.a.should == "an OK"
383
+ end
384
+
385
+ it "uses 'an' as the indefinite article for 'OLE'" do
386
+ "OLE".en.a.should == "an OLE"
387
+ end
388
+
389
+ it "uses 'an' as the indefinite article for 'octavo'" do
390
+ "octavo".en.a.should == "an octavo"
391
+ end
392
+
393
+ it "uses 'an' as the indefinite article for 'octopus'" do
394
+ "octopus".en.a.should == "an octopus"
395
+ end
396
+
397
+ it "uses 'an' as the indefinite article for 'okay'" do
398
+ "okay".en.a.should == "an okay"
399
+ end
400
+
401
+ it "uses 'a' as the indefinite article for 'once-and-future-king'" do
402
+ "once-and-future-king".en.a.should == "a once-and-future-king"
403
+ end
404
+
405
+ it "uses 'an' as the indefinite article for 'oncologist'" do
406
+ "oncologist".en.a.should == "an oncologist"
407
+ end
408
+
409
+ it "uses 'a' as the indefinite article for 'one night stand'" do
410
+ "one night stand".en.a.should == "a one night stand"
411
+ end
412
+
413
+ it "uses 'an' as the indefinite article for 'onerous task'" do
414
+ "onerous task".en.a.should == "an onerous task"
415
+ end
416
+
417
+ it "uses 'an' as the indefinite article for 'opera'" do
418
+ "opera".en.a.should == "an opera"
419
+ end
420
+
421
+ it "uses 'an' as the indefinite article for 'optimum'" do
422
+ "optimum".en.a.should == "an optimum"
423
+ end
424
+
425
+ it "uses 'an' as the indefinite article for 'opus'" do
426
+ "opus".en.a.should == "an opus"
427
+ end
428
+
429
+ it "uses 'an' as the indefinite article for 'ox'" do
430
+ "ox".en.a.should == "an ox"
431
+ end
432
+
433
+ it "uses 'a' as the indefinite article for 'Ph.D.'" do
434
+ "Ph.D.".en.a.should == "a Ph.D."
435
+ end
436
+
437
+ it "uses 'a' as the indefinite article for 'PET'" do
438
+ "PET".en.a.should == "a PET"
439
+ end
440
+
441
+ it "uses 'a' as the indefinite article for 'P.E.T. scan'" do
442
+ "P.E.T. scan".en.a.should == "a P.E.T. scan"
443
+ end
444
+
445
+ it "uses 'a' as the indefinite article for 'plateau'" do
446
+ "plateau".en.a.should == "a plateau"
447
+ end
448
+
449
+ it "uses 'a' as the indefinite article for 'quantum'" do
450
+ "quantum".en.a.should == "a quantum"
451
+ end
452
+
453
+ it "uses 'an' as the indefinite article for 'R.S.V.P.'" do
454
+ "R.S.V.P.".en.a.should == "an R.S.V.P."
455
+ end
456
+
457
+ it "uses 'an' as the indefinite article for 'RSVP'" do
458
+ "RSVP".en.a.should == "an RSVP"
459
+ end
460
+
461
+ it "uses 'a' as the indefinite article for 'REST'" do
462
+ "REST".en.a.should == "a REST"
463
+ end
464
+
465
+ it "uses 'a' as the indefinite article for 'reindeer'" do
466
+ "reindeer".en.a.should == "a reindeer"
467
+ end
468
+
469
+ it "uses 'an' as the indefinite article for 'S.O.S.'" do
470
+ "S.O.S.".en.a.should == "an S.O.S."
471
+ end
472
+
473
+ it "uses 'a' as the indefinite article for 'SUM'" do
474
+ "SUM".en.a.should == "a SUM"
475
+ end
476
+
477
+ it "uses 'an' as the indefinite article for 'SST'" do
478
+ "SST".en.a.should == "an SST"
479
+ end
480
+
481
+ it "uses 'a' as the indefinite article for 'salmon'" do
482
+ "salmon".en.a.should == "a salmon"
483
+ end
484
+
485
+ it "uses 'a' as the indefinite article for 'T.N.T. bomb'" do
486
+ "T.N.T. bomb".en.a.should == "a T.N.T. bomb"
487
+ end
488
+
489
+ it "uses 'a' as the indefinite article for 'TNT bomb'" do
490
+ "TNT bomb".en.a.should == "a TNT bomb"
491
+ end
492
+
493
+ it "uses 'a' as the indefinite article for 'TENT'" do
494
+ "TENT".en.a.should == "a TENT"
495
+ end
496
+
497
+ it "uses 'a' as the indefinite article for 'thought'" do
498
+ "thought".en.a.should == "a thought"
499
+ end
500
+
501
+ it "uses 'a' as the indefinite article for 'tomato'" do
502
+ "tomato".en.a.should == "a tomato"
503
+ end
504
+
505
+ it "uses 'a' as the indefinite article for 'U-boat'" do
506
+ "U-boat".en.a.should == "a U-boat"
507
+ end
508
+
509
+ it "uses 'a' as the indefinite article for 'U.F.O.'" do
510
+ "U.F.O.".en.a.should == "a U.F.O."
511
+ end
512
+
513
+ it "uses 'a' as the indefinite article for 'UFO'" do
514
+ "UFO".en.a.should == "a UFO"
515
+ end
516
+
517
+ it "uses 'a' as the indefinite article for 'ubiquity'" do
518
+ "ubiquity".en.a.should == "a ubiquity"
519
+ end
520
+
521
+ it "uses 'a' as the indefinite article for 'unicorn'" do
522
+ "unicorn".en.a.should == "a unicorn"
523
+ end
524
+
525
+ it "uses 'an' as the indefinite article for 'unidentified flying object'" do
526
+ "unidentified flying object".en.a.should == "an unidentified flying object"
527
+ end
528
+
529
+ it "uses 'a' as the indefinite article for 'uniform'" do
530
+ "uniform".en.a.should == "a uniform"
531
+ end
532
+
533
+ it "uses 'a' as the indefinite article for 'unimodal system'" do
534
+ "unimodal system".en.a.should == "a unimodal system"
535
+ end
536
+
537
+ it "uses 'an' as the indefinite article for 'unimpressive record'" do
538
+ "unimpressive record".en.a.should == "an unimpressive record"
539
+ end
540
+
541
+ it "uses 'an' as the indefinite article for 'uninformed opinion'" do
542
+ "uninformed opinion".en.a.should == "an uninformed opinion"
543
+ end
544
+
545
+ it "uses 'an' as the indefinite article for 'uninvited guest'" do
546
+ "uninvited guest".en.a.should == "an uninvited guest"
547
+ end
548
+
549
+ it "uses 'a' as the indefinite article for 'union'" do
550
+ "union".en.a.should == "a union"
551
+ end
552
+
553
+ it "uses 'a' as the indefinite article for 'uniplex'" do
554
+ "uniplex".en.a.should == "a uniplex"
555
+ end
556
+
557
+ it "uses 'a' as the indefinite article for 'uniprocessor'" do
558
+ "uniprocessor".en.a.should == "a uniprocessor"
559
+ end
560
+
561
+ it "uses 'a' as the indefinite article for 'unique opportunity'" do
562
+ "unique opportunity".en.a.should == "a unique opportunity"
563
+ end
564
+
565
+ it "uses 'a' as the indefinite article for 'unisex hairdresser'" do
566
+ "unisex hairdresser".en.a.should == "a unisex hairdresser"
567
+ end
568
+
569
+ it "uses 'a' as the indefinite article for 'unison'" do
570
+ "unison".en.a.should == "a unison"
571
+ end
572
+
573
+ it "uses 'a' as the indefinite article for 'unit'" do
574
+ "unit".en.a.should == "a unit"
575
+ end
576
+
577
+ it "uses 'a' as the indefinite article for 'unitarian'" do
578
+ "unitarian".en.a.should == "a unitarian"
579
+ end
580
+
581
+ it "uses 'a' as the indefinite article for 'united front'" do
582
+ "united front".en.a.should == "a united front"
583
+ end
584
+
585
+ it "uses 'a' as the indefinite article for 'unity'" do
586
+ "unity".en.a.should == "a unity"
587
+ end
588
+
589
+ it "uses 'a' as the indefinite article for 'univalent bond'" do
590
+ "univalent bond".en.a.should == "a univalent bond"
591
+ end
592
+
593
+ it "uses 'a' as the indefinite article for 'univariate statistic'" do
594
+ "univariate statistic".en.a.should == "a univariate statistic"
595
+ end
596
+
597
+ it "uses 'a' as the indefinite article for 'universe'" do
598
+ "universe".en.a.should == "a universe"
599
+ end
600
+
601
+ it "uses 'an' as the indefinite article for 'unordered meal'" do
602
+ "unordered meal".en.a.should == "an unordered meal"
603
+ end
604
+
605
+ it "uses 'a' as the indefinite article for 'uranium atom'" do
606
+ "uranium atom".en.a.should == "a uranium atom"
607
+ end
608
+
609
+ it "uses 'an' as the indefinite article for 'urban myth'" do
610
+ "urban myth".en.a.should == "an urban myth"
611
+ end
612
+
613
+ it "uses 'an' as the indefinite article for 'urbane miss'" do
614
+ "urbane miss".en.a.should == "an urbane miss"
615
+ end
616
+
617
+ it "uses 'an' as the indefinite article for 'urchin'" do
618
+ "urchin".en.a.should == "an urchin"
619
+ end
620
+
621
+ it "uses 'a' as the indefinite article for 'urea detector'" do
622
+ "urea detector".en.a.should == "a urea detector"
623
+ end
624
+
625
+ it "uses 'a' as the indefinite article for 'urethane monomer'" do
626
+ "urethane monomer".en.a.should == "a urethane monomer"
627
+ end
628
+
629
+ it "uses 'an' as the indefinite article for 'urge'" do
630
+ "urge".en.a.should == "an urge"
631
+ end
632
+
633
+ it "uses 'an' as the indefinite article for 'urgency'" do
634
+ "urgency".en.a.should == "an urgency"
635
+ end
636
+
637
+ it "uses 'a' as the indefinite article for 'urinal'" do
638
+ "urinal".en.a.should == "a urinal"
639
+ end
640
+
641
+ it "uses 'an' as the indefinite article for 'urn'" do
642
+ "urn".en.a.should == "an urn"
643
+ end
644
+
645
+ it "uses 'a' as the indefinite article for 'usage'" do
646
+ "usage".en.a.should == "a usage"
647
+ end
648
+
649
+ it "uses 'a' as the indefinite article for 'use'" do
650
+ "use".en.a.should == "a use"
651
+ end
652
+
653
+ it "uses 'an' as the indefinite article for 'usher'" do
654
+ "usher".en.a.should == "an usher"
655
+ end
656
+
657
+ it "uses 'a' as the indefinite article for 'usual suspect'" do
658
+ "usual suspect".en.a.should == "a usual suspect"
659
+ end
660
+
661
+ it "uses 'a' as the indefinite article for 'usurer'" do
662
+ "usurer".en.a.should == "a usurer"
663
+ end
664
+
665
+ it "uses 'a' as the indefinite article for 'usurper'" do
666
+ "usurper".en.a.should == "a usurper"
667
+ end
668
+
669
+ it "uses 'a' as the indefinite article for 'utensil'" do
670
+ "utensil".en.a.should == "a utensil"
671
+ end
672
+
673
+ it "uses 'a' as the indefinite article for 'utility'" do
674
+ "utility".en.a.should == "a utility"
675
+ end
676
+
677
+ it "uses 'an' as the indefinite article for 'utmost urgency'" do
678
+ "utmost urgency".en.a.should == "an utmost urgency"
679
+ end
680
+
681
+ it "uses 'a' as the indefinite article for 'utopia'" do
682
+ "utopia".en.a.should == "a utopia"
683
+ end
684
+
685
+ it "uses 'an' as the indefinite article for 'utterance'" do
686
+ "utterance".en.a.should == "an utterance"
687
+ end
688
+
689
+ it "uses 'a' as the indefinite article for 'V.I.P.'" do
690
+ "V.I.P.".en.a.should == "a V.I.P."
691
+ end
692
+
693
+ it "uses 'a' as the indefinite article for 'VIPER'" do
694
+ "VIPER".en.a.should == "a VIPER"
695
+ end
696
+
697
+ it "uses 'a' as the indefinite article for 'viper'" do
698
+ "viper".en.a.should == "a viper"
699
+ end
700
+
701
+ it "uses 'an' as the indefinite article for 'X-ray'" do
702
+ "X-ray".en.a.should == "an X-ray"
703
+ end
704
+
705
+ it "uses 'an' as the indefinite article for 'X.O.'" do
706
+ "X.O.".en.a.should == "an X.O."
707
+ end
708
+
709
+ it "uses 'a' as the indefinite article for 'XYLAPHONE'" do
710
+ "XYLAPHONE".en.a.should == "a XYLAPHONE"
711
+ end
712
+
713
+ it "uses 'an' as the indefinite article for 'XY chromosome'" do
714
+ "XY chromosome".en.a.should == "an XY chromosome"
715
+ end
716
+
717
+ it "uses 'a' as the indefinite article for 'xenophobe'" do
718
+ "xenophobe".en.a.should == "a xenophobe"
719
+ end
720
+
721
+ it "uses 'a' as the indefinite article for 'Y-shaped pipe'" do
722
+ "Y-shaped pipe".en.a.should == "a Y-shaped pipe"
723
+ end
724
+
725
+ it "uses 'a' as the indefinite article for 'Y.Z. plane'" do
726
+ "Y.Z. plane".en.a.should == "a Y.Z. plane"
727
+ end
728
+
729
+ it "uses 'a' as the indefinite article for 'YMCA'" do
730
+ "YMCA".en.a.should == "a YMCA"
731
+ end
732
+
733
+ it "uses 'an' as the indefinite article for 'YBLENT eye'" do
734
+ "YBLENT eye".en.a.should == "an YBLENT eye"
735
+ end
736
+
737
+ it "uses 'an' as the indefinite article for 'yblent eye'" do
738
+ "yblent eye".en.a.should == "an yblent eye"
739
+ end
740
+
741
+ it "uses 'an' as the indefinite article for 'yclad body'" do
742
+ "yclad body".en.a.should == "an yclad body"
743
+ end
744
+
745
+ it "uses 'a' as the indefinite article for 'yellowing'" do
746
+ "yellowing".en.a.should == "a yellowing"
747
+ end
748
+
749
+ it "uses 'a' as the indefinite article for 'yield'" do
750
+ "yield".en.a.should == "a yield"
751
+ end
752
+
753
+ it "uses 'a' as the indefinite article for 'youth'" do
754
+ "youth".en.a.should == "a youth"
755
+ end
756
+
757
+ it "uses 'a' as the indefinite article for 'youth'" do
758
+ "youth".en.a.should == "a youth"
759
+ end
760
+
761
+ it "uses 'an' as the indefinite article for 'ypsiliform junction'" do
762
+ "ypsiliform junction".en.a.should == "an ypsiliform junction"
763
+ end
764
+
765
+ it "uses 'an' as the indefinite article for 'yttrium atom'" do
766
+ "yttrium atom".en.a.should == "an yttrium atom"
767
+ end
768
+
769
+ it "uses 'a' as the indefinite article for 'zoo'" do
770
+ "zoo".en.a.should == "a zoo"
771
+ end
772
+
773
+
774
+ context "lprintf formatters" do
775
+
776
+ it "registers the :A lprintf formatter" do
777
+ Linguistics::EN.lprintf_formatters.should include( :A )
778
+ end
779
+
780
+ it "registers the :AN lprintf formatter" do
781
+ Linguistics::EN.lprintf_formatters.should include( :AN )
782
+ end
783
+
784
+ it "adds an indefinite article to the argument to %A" do
785
+ "You pick up %A.".en.lprintf( "umbrella" ).
786
+ should == "You pick up an umbrella."
787
+ end
788
+
789
+ it "adds an indefinite article to the argument to %AN" do
790
+ "You pick up %AN.".en.lprintf( "chocolate bar" ).
791
+ should == "You pick up a chocolate bar."
792
+ end
793
+
794
+ end
795
+
796
+ end
797
+