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,66 @@
1
+ #!/usr/bin/env spec -cfs
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/linkparser'
18
+
19
+
20
+ describe Linguistics::EN::LinkParser do
21
+
22
+ before( :all ) do
23
+ setup_logging( :fatal )
24
+ Linguistics.use( :en )
25
+ end
26
+
27
+ after( :all ) do
28
+ reset_logging()
29
+ end
30
+
31
+
32
+ it "adds EN::LinkParser to the list of English language modules" do
33
+ Linguistics::EN::MODULES.include?( Linguistics::EN::LinkParser )
34
+ end
35
+
36
+
37
+ describe "on a system that has the 'linkparser' library installed" do
38
+
39
+ it "can create a LinkParser::Sentence from a sentence in a string" do
40
+ pending "installation of the linkparser library" unless
41
+ Linguistics::EN.has_linkparser?
42
+ "This is a sentence.".en.sentence.should be_a( LinkParser::Sentence )
43
+ end
44
+
45
+ end
46
+
47
+
48
+ describe "on a system that doesn't have the 'linkparser' library" do
49
+ it "raises an NotImplementedError when you try to use linkparser functionality" do
50
+
51
+ # If the system *does* have linkparser support, pretend it doesn't.
52
+ if Linguistics::EN.has_linkparser?
53
+ Linguistics::EN::LinkParser.stub( :has_linkparser? ).and_return( false )
54
+ exception = stub( "linkparser load error", :message => 'no such file to load' )
55
+ Linguistics::EN::LinkParser.stub( :lp_error ).and_return( exception )
56
+ end
57
+
58
+ expect {
59
+ "This is a sentence.".en.sentence
60
+ }.to raise_error( NotImplementedError, /not loaded/i )
61
+ end
62
+
63
+ end
64
+
65
+ end
66
+
@@ -0,0 +1,1295 @@
1
+ #!/usr/bin/env spec -cfs
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/numbers'
18
+
19
+
20
+ describe Linguistics::EN::Numbers do
21
+
22
+ before( :all ) do
23
+ setup_logging( :fatal )
24
+ Linguistics.use( :en )
25
+ end
26
+
27
+ after( :all ) do
28
+ reset_logging()
29
+ end
30
+
31
+
32
+ it "adds EN::Numbers to the list of English language modules" do
33
+ Linguistics::EN.should have_extension( :numbers )
34
+ end
35
+
36
+ describe "numbers to words" do
37
+
38
+ it "can transform 0 into english words" do
39
+ "0".en.numwords.should == "zero"
40
+ end
41
+
42
+ it "can transform 0 into english words in single-digit groups" do
43
+ "0".en.numwords( :group => 1 ).should == "zero"
44
+ end
45
+
46
+ it "can transform 0 into english words in double-digit groups" do
47
+ "0".en.numwords( :group => 2 ).should == "zero"
48
+ end
49
+
50
+ it "can transform 0 into english words in triple-digit groups" do
51
+ "0".en.numwords( :group => 3 ).should == "zero"
52
+ end
53
+
54
+
55
+ it "can transform the english words for 0 into an ordinal" do
56
+ "0".en.numwords.en.ordinal.should.should == "zeroth"
57
+ end
58
+
59
+
60
+ it "can transform 1 into english words" do
61
+ "1".en.numwords.should == "one"
62
+ end
63
+
64
+ it "can transform 1 into english words in single-digit groups" do
65
+ "1".en.numwords( :group => 1 ).should == "one"
66
+ end
67
+
68
+ it "can transform 1 into english words in double-digit groups" do
69
+ "1".en.numwords( :group => 2 ).should == "one"
70
+ end
71
+
72
+ it "can transform 1 into english words in triple-digit groups" do
73
+ "1".en.numwords( :group => 3 ).should == "one"
74
+ end
75
+
76
+
77
+ it "can transform the english words for 1 into an ordinal" do
78
+ "1".en.numwords.en.ordinal.should == "first"
79
+ end
80
+
81
+
82
+ it "can transform 2 into english words" do
83
+ "2".en.numwords.should == "two"
84
+ end
85
+
86
+ it "can transform 2 into english words in single-digit groups" do
87
+ "2".en.numwords( :group => 1 ).should == "two"
88
+ end
89
+
90
+ it "can transform 2 into english words in double-digit groups" do
91
+ "2".en.numwords( :group => 2 ).should == "two"
92
+ end
93
+
94
+ it "can transform 2 into english words in triple-digit groups" do
95
+ "2".en.numwords( :group => 3 ).should == "two"
96
+ end
97
+
98
+
99
+ it "can transform the english words for 2 into an ordinal" do
100
+ "2".en.numwords.en.ordinal.should == "second"
101
+ end
102
+
103
+
104
+ it "can transform 3 into english words" do
105
+ "3".en.numwords.should == "three"
106
+ end
107
+
108
+ it "can transform 3 into english words in single-digit groups" do
109
+ "3".en.numwords( :group => 1 ).should == "three"
110
+ end
111
+
112
+ it "can transform 3 into english words in double-digit groups" do
113
+ "3".en.numwords( :group => 2 ).should == "three"
114
+ end
115
+
116
+ it "can transform 3 into english words in triple-digit groups" do
117
+ "3".en.numwords( :group => 3 ).should == "three"
118
+ end
119
+
120
+
121
+ it "can transform the english words for 3 into an ordinal" do
122
+ "3".en.numwords.en.ordinal.should == "third"
123
+ end
124
+
125
+
126
+ it "can transform 4 into english words" do
127
+ "4".en.numwords.should == "four"
128
+ end
129
+
130
+ it "can transform 4 into english words in single-digit groups" do
131
+ "4".en.numwords( :group => 1 ).should == "four"
132
+ end
133
+
134
+ it "can transform 4 into english words in double-digit groups" do
135
+ "4".en.numwords( :group => 2 ).should == "four"
136
+ end
137
+
138
+ it "can transform 4 into english words in triple-digit groups" do
139
+ "4".en.numwords( :group => 3 ).should == "four"
140
+ end
141
+
142
+
143
+ it "can transform the english words for 4 into an ordinal" do
144
+ "4".en.numwords.en.ordinal.should == "fourth"
145
+ end
146
+
147
+
148
+ it "can transform 5 into english words" do
149
+ "5".en.numwords.should == "five"
150
+ end
151
+
152
+ it "can transform 5 into english words in single-digit groups" do
153
+ "5".en.numwords( :group => 1 ).should == "five"
154
+ end
155
+
156
+ it "can transform 5 into english words in double-digit groups" do
157
+ "5".en.numwords( :group => 2 ).should == "five"
158
+ end
159
+
160
+ it "can transform 5 into english words in triple-digit groups" do
161
+ "5".en.numwords( :group => 3 ).should == "five"
162
+ end
163
+
164
+
165
+ it "can transform the english words for 5 into an ordinal" do
166
+ "5".en.numwords.en.ordinal.should == "fifth"
167
+ end
168
+
169
+
170
+ it "can transform 6 into english words" do
171
+ "6".en.numwords.should == "six"
172
+ end
173
+
174
+ it "can transform 6 into english words in single-digit groups" do
175
+ "6".en.numwords( :group => 1 ).should == "six"
176
+ end
177
+
178
+ it "can transform 6 into english words in double-digit groups" do
179
+ "6".en.numwords( :group => 2 ).should == "six"
180
+ end
181
+
182
+ it "can transform 6 into english words in triple-digit groups" do
183
+ "6".en.numwords( :group => 3 ).should == "six"
184
+ end
185
+
186
+
187
+ it "can transform the english words for 6 into an ordinal" do
188
+ "6".en.numwords.en.ordinal.should == "sixth"
189
+ end
190
+
191
+
192
+ it "can transform 7 into english words" do
193
+ "7".en.numwords.should == "seven"
194
+ end
195
+
196
+ it "can transform 7 into english words in single-digit groups" do
197
+ "7".en.numwords( :group => 1 ).should == "seven"
198
+ end
199
+
200
+ it "can transform 7 into english words in double-digit groups" do
201
+ "7".en.numwords( :group => 2 ).should == "seven"
202
+ end
203
+
204
+ it "can transform 7 into english words in triple-digit groups" do
205
+ "7".en.numwords( :group => 3 ).should == "seven"
206
+ end
207
+
208
+
209
+ it "can transform the english words for 7 into an ordinal" do
210
+ "7".en.numwords.en.ordinal.should == "seventh"
211
+ end
212
+
213
+
214
+ it "can transform 8 into english words" do
215
+ "8".en.numwords.should == "eight"
216
+ end
217
+
218
+ it "can transform 8 into english words in single-digit groups" do
219
+ "8".en.numwords( :group => 1 ).should == "eight"
220
+ end
221
+
222
+ it "can transform 8 into english words in double-digit groups" do
223
+ "8".en.numwords( :group => 2 ).should == "eight"
224
+ end
225
+
226
+ it "can transform 8 into english words in triple-digit groups" do
227
+ "8".en.numwords( :group => 3 ).should == "eight"
228
+ end
229
+
230
+
231
+ it "can transform the english words for 8 into an ordinal" do
232
+ "8".en.numwords.en.ordinal.should == "eighth"
233
+ end
234
+
235
+
236
+ it "can transform 9 into english words" do
237
+ "9".en.numwords.should == "nine"
238
+ end
239
+
240
+ it "can transform 9 into english words in single-digit groups" do
241
+ "9".en.numwords( :group => 1 ).should == "nine"
242
+ end
243
+
244
+ it "can transform 9 into english words in double-digit groups" do
245
+ "9".en.numwords( :group => 2 ).should == "nine"
246
+ end
247
+
248
+ it "can transform 9 into english words in triple-digit groups" do
249
+ "9".en.numwords( :group => 3 ).should == "nine"
250
+ end
251
+
252
+
253
+ it "can transform the english words for 9 into an ordinal" do
254
+ "9".en.numwords.en.ordinal.should == "ninth"
255
+ end
256
+
257
+
258
+ it "can transform 10 into english words" do
259
+ "10".en.numwords.should == "ten"
260
+ end
261
+
262
+ it "can transform 10 into english words in single-digit groups" do
263
+ "10".en.numwords( :group => 1 ).should == "one, zero"
264
+ end
265
+
266
+ it "can transform 10 into english words in double-digit groups" do
267
+ "10".en.numwords( :group => 2 ).should == "ten"
268
+ end
269
+
270
+ it "can transform 10 into english words in triple-digit groups" do
271
+ "10".en.numwords( :group => 3 ).should == "ten"
272
+ end
273
+
274
+
275
+ it "can transform the english words for 10 into an ordinal" do
276
+ "10".en.numwords.en.ordinal.should == "tenth"
277
+ end
278
+
279
+
280
+ it "can transform 11 into english words" do
281
+ "11".en.numwords.should == "eleven"
282
+ end
283
+
284
+ it "can transform 11 into english words in single-digit groups" do
285
+ "11".en.numwords( :group => 1 ).should == "one, one"
286
+ end
287
+
288
+ it "can transform 11 into english words in double-digit groups" do
289
+ "11".en.numwords( :group => 2 ).should == "eleven"
290
+ end
291
+
292
+ it "can transform 11 into english words in triple-digit groups" do
293
+ "11".en.numwords( :group => 3 ).should == "eleven"
294
+ end
295
+
296
+
297
+ it "can transform the english words for 11 into an ordinal" do
298
+ "11".en.numwords.en.ordinal.should == "eleventh"
299
+ end
300
+
301
+
302
+ it "can transform 12 into english words" do
303
+ "12".en.numwords.should == "twelve"
304
+ end
305
+
306
+ it "can transform 12 into english words in single-digit groups" do
307
+ "12".en.numwords( :group => 1 ).should == "one, two"
308
+ end
309
+
310
+ it "can transform 12 into english words in double-digit groups" do
311
+ "12".en.numwords( :group => 2 ).should == "twelve"
312
+ end
313
+
314
+ it "can transform 12 into english words in triple-digit groups" do
315
+ "12".en.numwords( :group => 3 ).should == "twelve"
316
+ end
317
+
318
+
319
+ it "can transform the english words for 12 into an ordinal" do
320
+ "12".en.numwords.en.ordinal.should == "twelfth"
321
+ end
322
+
323
+
324
+ it "can transform 13 into english words" do
325
+ "13".en.numwords.should == "thirteen"
326
+ end
327
+
328
+ it "can transform 13 into english words in single-digit groups" do
329
+ "13".en.numwords( :group => 1 ).should == "one, three"
330
+ end
331
+
332
+ it "can transform 13 into english words in double-digit groups" do
333
+ "13".en.numwords( :group => 2 ).should == "thirteen"
334
+ end
335
+
336
+ it "can transform 13 into english words in triple-digit groups" do
337
+ "13".en.numwords( :group => 3 ).should == "thirteen"
338
+ end
339
+
340
+
341
+ it "can transform the english words for 13 into an ordinal" do
342
+ "13".en.numwords.en.ordinal.should == "thirteenth"
343
+ end
344
+
345
+
346
+ it "can transform 14 into english words" do
347
+ "14".en.numwords.should == "fourteen"
348
+ end
349
+
350
+ it "can transform 14 into english words in single-digit groups" do
351
+ "14".en.numwords( :group => 1 ).should == "one, four"
352
+ end
353
+
354
+ it "can transform 14 into english words in double-digit groups" do
355
+ "14".en.numwords( :group => 2 ).should == "fourteen"
356
+ end
357
+
358
+ it "can transform 14 into english words in triple-digit groups" do
359
+ "14".en.numwords( :group => 3 ).should == "fourteen"
360
+ end
361
+
362
+
363
+ it "can transform the english words for 14 into an ordinal" do
364
+ "14".en.numwords.en.ordinal.should == "fourteenth"
365
+ end
366
+
367
+
368
+ it "can transform 15 into english words" do
369
+ "15".en.numwords.should == "fifteen"
370
+ end
371
+
372
+ it "can transform 15 into english words in single-digit groups" do
373
+ "15".en.numwords( :group => 1 ).should == "one, five"
374
+ end
375
+
376
+ it "can transform 15 into english words in double-digit groups" do
377
+ "15".en.numwords( :group => 2 ).should == "fifteen"
378
+ end
379
+
380
+ it "can transform 15 into english words in triple-digit groups" do
381
+ "15".en.numwords( :group => 3 ).should == "fifteen"
382
+ end
383
+
384
+
385
+ it "can transform the english words for 15 into an ordinal" do
386
+ "15".en.numwords.en.ordinal.should == "fifteenth"
387
+ end
388
+
389
+
390
+ it "can transform 16 into english words" do
391
+ "16".en.numwords.should == "sixteen"
392
+ end
393
+
394
+ it "can transform 16 into english words in single-digit groups" do
395
+ "16".en.numwords( :group => 1 ).should == "one, six"
396
+ end
397
+
398
+ it "can transform 16 into english words in double-digit groups" do
399
+ "16".en.numwords( :group => 2 ).should == "sixteen"
400
+ end
401
+
402
+ it "can transform 16 into english words in triple-digit groups" do
403
+ "16".en.numwords( :group => 3 ).should == "sixteen"
404
+ end
405
+
406
+
407
+ it "can transform the english words for 16 into an ordinal" do
408
+ "16".en.numwords.en.ordinal.should == "sixteenth"
409
+ end
410
+
411
+
412
+ it "can transform 17 into english words" do
413
+ "17".en.numwords.should == "seventeen"
414
+ end
415
+
416
+ it "can transform 17 into english words in single-digit groups" do
417
+ "17".en.numwords( :group => 1 ).should == "one, seven"
418
+ end
419
+
420
+ it "can transform 17 into english words in double-digit groups" do
421
+ "17".en.numwords( :group => 2 ).should == "seventeen"
422
+ end
423
+
424
+ it "can transform 17 into english words in triple-digit groups" do
425
+ "17".en.numwords( :group => 3 ).should == "seventeen"
426
+ end
427
+
428
+
429
+ it "can transform the english words for 17 into an ordinal" do
430
+ "17".en.numwords.en.ordinal.should == "seventeenth"
431
+ end
432
+
433
+
434
+ it "can transform 18 into english words" do
435
+ "18".en.numwords.should == "eighteen"
436
+ end
437
+
438
+ it "can transform 18 into english words in single-digit groups" do
439
+ "18".en.numwords( :group => 1 ).should == "one, eight"
440
+ end
441
+
442
+ it "can transform 18 into english words in double-digit groups" do
443
+ "18".en.numwords( :group => 2 ).should == "eighteen"
444
+ end
445
+
446
+ it "can transform 18 into english words in triple-digit groups" do
447
+ "18".en.numwords( :group => 3 ).should == "eighteen"
448
+ end
449
+
450
+
451
+ it "can transform the english words for 18 into an ordinal" do
452
+ "18".en.numwords.en.ordinal.should == "eighteenth"
453
+ end
454
+
455
+
456
+ it "can transform 19 into english words" do
457
+ "19".en.numwords.should == "nineteen"
458
+ end
459
+
460
+ it "can transform 19 into english words in single-digit groups" do
461
+ "19".en.numwords( :group => 1 ).should == "one, nine"
462
+ end
463
+
464
+ it "can transform 19 into english words in double-digit groups" do
465
+ "19".en.numwords( :group => 2 ).should == "nineteen"
466
+ end
467
+
468
+ it "can transform 19 into english words in triple-digit groups" do
469
+ "19".en.numwords( :group => 3 ).should == "nineteen"
470
+ end
471
+
472
+
473
+ it "can transform the english words for 19 into an ordinal" do
474
+ "19".en.numwords.en.ordinal.should == "nineteenth"
475
+ end
476
+
477
+
478
+ it "can transform 20 into english words" do
479
+ "20".en.numwords.should == "twenty"
480
+ end
481
+
482
+ it "can transform 20 into english words in single-digit groups" do
483
+ "20".en.numwords( :group => 1 ).should == "two, zero"
484
+ end
485
+
486
+ it "can transform 20 into english words in double-digit groups" do
487
+ "20".en.numwords( :group => 2 ).should == "twenty"
488
+ end
489
+
490
+ it "can transform 20 into english words in triple-digit groups" do
491
+ "20".en.numwords( :group => 3 ).should == "twenty"
492
+ end
493
+
494
+
495
+ it "can transform the english words for 20 into an ordinal" do
496
+ "20".en.numwords.en.ordinal.should == "twentieth"
497
+ end
498
+
499
+
500
+ it "can transform 21 into english words" do
501
+ "21".en.numwords.should == "twenty-one"
502
+ end
503
+
504
+ it "can transform 21 into english words in single-digit groups" do
505
+ "21".en.numwords( :group => 1 ).should == "two, one"
506
+ end
507
+
508
+ it "can transform 21 into english words in double-digit groups" do
509
+ "21".en.numwords( :group => 2 ).should == "twenty-one"
510
+ end
511
+
512
+ it "can transform 21 into english words in triple-digit groups" do
513
+ "21".en.numwords( :group => 3 ).should == "twenty-one"
514
+ end
515
+
516
+
517
+ it "can transform the english words for 21 into an ordinal" do
518
+ "21".en.numwords.en.ordinal.should == "twenty-first"
519
+ end
520
+
521
+
522
+ it "can transform 29 into english words" do
523
+ "29".en.numwords.should == "twenty-nine"
524
+ end
525
+
526
+ it "can transform 29 into english words in single-digit groups" do
527
+ "29".en.numwords( :group => 1 ).should == "two, nine"
528
+ end
529
+
530
+ it "can transform 29 into english words in double-digit groups" do
531
+ "29".en.numwords( :group => 2 ).should == "twenty-nine"
532
+ end
533
+
534
+ it "can transform 29 into english words in triple-digit groups" do
535
+ "29".en.numwords( :group => 3 ).should == "twenty-nine"
536
+ end
537
+
538
+
539
+ it "can transform the english words for 29 into an ordinal" do
540
+ "29".en.numwords.en.ordinal.should == "twenty-ninth"
541
+ end
542
+
543
+
544
+ it "can transform 99 into english words" do
545
+ "99".en.numwords.should == "ninety-nine"
546
+ end
547
+
548
+ it "can transform 99 into english words in single-digit groups" do
549
+ "99".en.numwords( :group => 1 ).should == "nine, nine"
550
+ end
551
+
552
+ it "can transform 99 into english words in double-digit groups" do
553
+ "99".en.numwords( :group => 2 ).should == "ninety-nine"
554
+ end
555
+
556
+ it "can transform 99 into english words in triple-digit groups" do
557
+ "99".en.numwords( :group => 3 ).should == "ninety-nine"
558
+ end
559
+
560
+
561
+ it "can transform the english words for 99 into an ordinal" do
562
+ "99".en.numwords.en.ordinal.should == "ninety-ninth"
563
+ end
564
+
565
+
566
+ it "can transform 100 into english words" do
567
+ "100".en.numwords.should == "one hundred"
568
+ end
569
+
570
+ it "can transform 100 into english words in single-digit groups" do
571
+ "100".en.numwords( :group => 1 ).should == "one, zero, zero"
572
+ end
573
+
574
+ it "can transform 100 into english words in double-digit groups" do
575
+ "100".en.numwords( :group => 2 ).should == "ten, zero"
576
+ end
577
+
578
+ it "can transform 100 into english words in triple-digit groups" do
579
+ "100".en.numwords( :group => 3 ).should == "one zero zero"
580
+ end
581
+
582
+
583
+ it "can transform the english words for 100 into an ordinal" do
584
+ "100".en.numwords.en.ordinal.should == "one hundredth"
585
+ end
586
+
587
+
588
+ it "can transform 101 into english words" do
589
+ "101".en.numwords.should == "one hundred and one"
590
+ end
591
+
592
+ it "can transform 101 into english words in single-digit groups" do
593
+ "101".en.numwords( :group => 1 ).should == "one, zero, one"
594
+ end
595
+
596
+ it "can transform 101 into english words in double-digit groups" do
597
+ "101".en.numwords( :group => 2 ).should == "ten, one"
598
+ end
599
+
600
+ it "can transform 101 into english words in triple-digit groups" do
601
+ "101".en.numwords( :group => 3 ).should == "one zero one"
602
+ end
603
+
604
+
605
+ it "can transform the english words for 101 into an ordinal" do
606
+ "101".en.numwords.en.ordinal.should == "one hundred and first"
607
+ end
608
+
609
+ it "can transform the english words for 101 into an ordinal" do
610
+ "101".en.numwords.en.ordinal.should == "one hundred and first"
611
+ end
612
+
613
+
614
+ it "can transform 110 into english words" do
615
+ "110".en.numwords.should == "one hundred and ten"
616
+ end
617
+
618
+ it "can transform 110 into english words in single-digit groups" do
619
+ "110".en.numwords( :group => 1 ).should == "one, one, zero"
620
+ end
621
+
622
+ it "can transform 110 into english words in double-digit groups" do
623
+ "110".en.numwords( :group => 2 ).should == "eleven, zero"
624
+ end
625
+
626
+ it "can transform 110 into english words in triple-digit groups" do
627
+ "110".en.numwords( :group => 3 ).should == "one ten"
628
+ end
629
+
630
+
631
+ it "can transform the english words for 110 into an ordinal" do
632
+ "110".en.numwords.en.ordinal.should == "one hundred and tenth"
633
+ end
634
+
635
+
636
+ it "can transform 111 into english words" do
637
+ "111".en.numwords.should == "one hundred and eleven"
638
+ end
639
+
640
+ it "can transform 111 into english words in single-digit groups" do
641
+ "111".en.numwords( :group => 1 ).should == "one, one, one"
642
+ end
643
+
644
+ it "can transform 111 into english words in double-digit groups" do
645
+ "111".en.numwords( :group => 2 ).should == "eleven, one"
646
+ end
647
+
648
+ it "can transform 111 into english words in triple-digit groups" do
649
+ "111".en.numwords( :group => 3 ).should == "one eleven"
650
+ end
651
+
652
+
653
+ it "can transform the english words for 111 into an ordinal" do
654
+ "111".en.numwords.en.ordinal.should == "one hundred and eleventh"
655
+ end
656
+
657
+
658
+ it "can transform 900 into english words" do
659
+ "900".en.numwords.should == "nine hundred"
660
+ end
661
+
662
+ it "can transform 900 into english words in single-digit groups" do
663
+ "900".en.numwords( :group => 1 ).should == "nine, zero, zero"
664
+ end
665
+
666
+ it "can transform 900 into english words in double-digit groups" do
667
+ "900".en.numwords( :group => 2 ).should == "ninety, zero"
668
+ end
669
+
670
+ it "can transform 900 into english words in triple-digit groups" do
671
+ "900".en.numwords( :group => 3 ).should == "nine zero zero"
672
+ end
673
+
674
+
675
+ it "can transform the english words for 900 into an ordinal" do
676
+ "900".en.numwords.en.ordinal.should == "nine hundredth"
677
+ end
678
+
679
+
680
+ it "can transform 999 into english words" do
681
+ "999".en.numwords.should == "nine hundred and ninety-nine"
682
+ end
683
+
684
+ it "can transform 999 into english words in single-digit groups" do
685
+ "999".en.numwords( :group => 1 ).should == "nine, nine, nine"
686
+ end
687
+
688
+ it "can transform 999 into english words in double-digit groups" do
689
+ "999".en.numwords( :group => 2 ).should == "ninety-nine, nine"
690
+ end
691
+
692
+ it "can transform 999 into english words in triple-digit groups" do
693
+ "999".en.numwords( :group => 3 ).should == "nine ninety-nine"
694
+ end
695
+
696
+
697
+ it "can transform the english words for 999 into an ordinal" do
698
+ "999".en.numwords.en.ordinal.should == "nine hundred and ninety-ninth"
699
+ end
700
+
701
+
702
+ it "can transform 1000 into english words" do
703
+ "1000".en.numwords.should == "one thousand"
704
+ end
705
+
706
+ it "can transform 1000 into english words in single-digit groups" do
707
+ "1000".en.numwords( :group => 1 ).should == "one, zero, zero, zero"
708
+ end
709
+
710
+ it "can transform 1000 into english words in double-digit groups" do
711
+ "1000".en.numwords( :group => 2 ).should == "ten, zero zero"
712
+ end
713
+
714
+ it "can transform 1000 into english words in triple-digit groups" do
715
+ "1000".en.numwords( :group => 3 ).should == "one zero zero, zero"
716
+ end
717
+
718
+
719
+ it "can transform the english words for 1000 into an ordinal" do
720
+ "1000".en.numwords.en.ordinal.should == "one thousandth"
721
+ end
722
+
723
+
724
+ it "can transform 1001 into english words" do
725
+ "1001".en.numwords.should == "one thousand and one"
726
+ end
727
+
728
+ it "can transform 1001 into english words in single-digit groups" do
729
+ "1001".en.numwords( :group => 1 ).should == "one, zero, zero, one"
730
+ end
731
+
732
+ it "can transform 1001 into english words in double-digit groups" do
733
+ "1001".en.numwords( :group => 2 ).should == "ten, zero one"
734
+ end
735
+
736
+ it "can transform 1001 into english words in triple-digit groups" do
737
+ "1001".en.numwords( :group => 3 ).should == "one zero zero, one"
738
+ end
739
+
740
+
741
+ it "can transform the english words for 1001 into an ordinal" do
742
+ "1001".en.numwords.en.ordinal.should == "one thousand and first"
743
+ end
744
+
745
+
746
+ it "can transform 1010 into english words" do
747
+ "1010".en.numwords.should == "one thousand and ten"
748
+ end
749
+
750
+ it "can transform 1010 into english words in single-digit groups" do
751
+ "1010".en.numwords( :group => 1 ).should == "one, zero, one, zero"
752
+ end
753
+
754
+ it "can transform 1010 into english words in double-digit groups" do
755
+ "1010".en.numwords( :group => 2 ).should == "ten, ten"
756
+ end
757
+
758
+ it "can transform 1010 into english words in triple-digit groups" do
759
+ "1010".en.numwords( :group => 3 ).should == "one zero one, zero"
760
+ end
761
+
762
+
763
+ it "can transform the english words for 1010 into an ordinal" do
764
+ "1010".en.numwords.en.ordinal.should == "one thousand and tenth"
765
+ end
766
+
767
+
768
+ it "can transform 1100 into english words" do
769
+ "1100".en.numwords.should == "one thousand, one hundred"
770
+ end
771
+
772
+ it "can transform 1100 into english words in single-digit groups" do
773
+ "1100".en.numwords( :group => 1 ).should == "one, one, zero, zero"
774
+ end
775
+
776
+ it "can transform 1100 into english words in double-digit groups" do
777
+ "1100".en.numwords( :group => 2 ).should == "eleven, zero zero"
778
+ end
779
+
780
+ it "can transform 1100 into english words in triple-digit groups" do
781
+ "1100".en.numwords( :group => 3 ).should == "one ten, zero"
782
+ end
783
+
784
+
785
+ it "can transform the english words for 1100 into an ordinal" do
786
+ "1100".en.numwords.en.ordinal.should == "one thousand, one hundredth"
787
+ end
788
+
789
+
790
+ it "can transform 2000 into english words" do
791
+ "2000".en.numwords.should == "two thousand"
792
+ end
793
+
794
+ it "can transform 2000 into english words in single-digit groups" do
795
+ "2000".en.numwords( :group => 1 ).should == "two, zero, zero, zero"
796
+ end
797
+
798
+ it "can transform 2000 into english words in double-digit groups" do
799
+ "2000".en.numwords( :group => 2 ).should == "twenty, zero zero"
800
+ end
801
+
802
+ it "can transform 2000 into english words in triple-digit groups" do
803
+ "2000".en.numwords( :group => 3 ).should == "two zero zero, zero"
804
+ end
805
+
806
+
807
+ it "can transform the english words for 2000 into an ordinal" do
808
+ "2000".en.numwords.en.ordinal.should == "two thousandth"
809
+ end
810
+
811
+
812
+ it "can transform 10000 into english words" do
813
+ "10000".en.numwords.should == "ten thousand"
814
+ end
815
+
816
+ it "can transform 10000 into english words in single-digit groups" do
817
+ "10000".en.numwords( :group => 1 ).should == "one, zero, zero, zero, zero"
818
+ end
819
+
820
+ it "can transform 10000 into english words in double-digit groups" do
821
+ "10000".en.numwords( :group => 2 ).should == "ten, zero zero, zero"
822
+ end
823
+
824
+ it "can transform 10000 into english words in triple-digit groups" do
825
+ "10000".en.numwords( :group => 3 ).should == "one zero zero, zero zero"
826
+ end
827
+
828
+
829
+ it "can transform the english words for 10000 into an ordinal" do
830
+ "10000".en.numwords.en.ordinal.should == "ten thousandth"
831
+ end
832
+
833
+
834
+ it "can transform 100000 into english words" do
835
+ "100000".en.numwords.should == "one hundred thousand"
836
+ end
837
+
838
+ it "can transform 100000 into english words in single-digit groups" do
839
+ "100000".en.numwords( :group => 1 ).should == "one, zero, zero, zero, zero, zero"
840
+ end
841
+
842
+ it "can transform 100000 into english words in double-digit groups" do
843
+ "100000".en.numwords( :group => 2 ).should == "ten, zero zero, zero zero"
844
+ end
845
+
846
+ it "can transform 100000 into english words in triple-digit groups" do
847
+ "100000".en.numwords( :group => 3 ).should == "one zero zero, zero zero zero"
848
+ end
849
+
850
+
851
+ it "can transform the english words for 100000 into an ordinal" do
852
+ "100000".en.numwords.en.ordinal.should == "one hundred thousandth"
853
+ end
854
+
855
+
856
+ it "can transform 100001 into english words" do
857
+ "100001".en.numwords.should == "one hundred thousand and one"
858
+ end
859
+
860
+ it "can transform 100001 into english words in single-digit groups" do
861
+ "100001".en.numwords( :group => 1 ).should == "one, zero, zero, zero, zero, one"
862
+ end
863
+
864
+ it "can transform 100001 into english words in double-digit groups" do
865
+ "100001".en.numwords( :group => 2 ).should == "ten, zero zero, zero one"
866
+ end
867
+
868
+ it "can transform 100001 into english words in triple-digit groups" do
869
+ "100001".en.numwords( :group => 3 ).should == "one zero zero, zero zero one"
870
+ end
871
+
872
+
873
+ it "can transform the english words for 100001 into an ordinal" do
874
+ "100001".en.numwords.en.ordinal.should == "one hundred thousand and first"
875
+ end
876
+
877
+
878
+ it "can transform 123456 into english words" do
879
+ "123456".en.numwords.should == "one hundred and twenty-three thousand, four hundred and fifty-six"
880
+ end
881
+
882
+ it "can transform 123456 into english words in single-digit groups" do
883
+ "123456".en.numwords( :group => 1 ).should == "one, two, three, four, five, six"
884
+ end
885
+
886
+ it "can transform 123456 into english words in double-digit groups" do
887
+ "123456".en.numwords( :group => 2 ).should == "twelve, thirty-four, fifty-six"
888
+ end
889
+
890
+ it "can transform 123456 into english words in triple-digit groups" do
891
+ "123456".en.numwords( :group => 3 ).should == "one twenty-three, four fifty-six"
892
+ end
893
+
894
+
895
+ it "can transform the english words for 123456 into an ordinal" do
896
+ "123456".en.numwords.en.ordinal.should == "one hundred and twenty-three thousand, four hundred and fifty-sixth"
897
+ end
898
+
899
+
900
+ it "can transform 0123456 into english words" do
901
+ "0123456".en.numwords.should == "one hundred and twenty-three thousand, four hundred and fifty-six"
902
+ end
903
+
904
+ it "can transform 0123456 into english words in single-digit groups" do
905
+ "0123456".en.numwords( :group => 1 ).should == "zero, one, two, three, four, five, six"
906
+ end
907
+
908
+ it "can transform 0123456 into english words in double-digit groups" do
909
+ "0123456".en.numwords( :group => 2 ).should == "zero one, twenty-three, forty-five, six"
910
+ end
911
+
912
+ it "can transform 0123456 into english words in triple-digit groups" do
913
+ "0123456".en.numwords( :group => 3 ).should == "zero twelve, three forty-five, six"
914
+ end
915
+
916
+
917
+ it "can transform the english words for 0123456 into an ordinal" do
918
+ "0123456".en.numwords.en.ordinal.should == "one hundred and twenty-three thousand, four hundred and fifty-sixth"
919
+ end
920
+
921
+
922
+ it "can transform 1234567 into english words" do
923
+ "1234567".en.numwords.should == "one million, two hundred and thirty-four thousand, five hundred and sixty-seven"
924
+ end
925
+
926
+ it "can transform 1234567 into english words in single-digit groups" do
927
+ "1234567".en.numwords( :group => 1 ).should == "one, two, three, four, five, six, seven"
928
+ end
929
+
930
+ it "can transform 1234567 into english words in double-digit groups" do
931
+ "1234567".en.numwords( :group => 2 ).should == "twelve, thirty-four, fifty-six, seven"
932
+ end
933
+
934
+ it "can transform 1234567 into english words in triple-digit groups" do
935
+ "1234567".en.numwords( :group => 3 ).should == "one twenty-three, four fifty-six, seven"
936
+ end
937
+
938
+
939
+ it "can transform the english words for 1234567 into an ordinal" do
940
+ "1234567".en.numwords.en.ordinal.should == "one million, two hundred and thirty-four thousand, five hundred and sixty-seventh"
941
+ end
942
+
943
+
944
+ it "can transform 12345678 into english words" do
945
+ "12345678".en.numwords.should == "twelve million, three hundred and forty-five thousand, six hundred and seventy-eight"
946
+ end
947
+
948
+ it "can transform 12345678 into english words in single-digit groups" do
949
+ "12345678".en.numwords( :group => 1 ).should == "one, two, three, four, five, six, seven, eight"
950
+ end
951
+
952
+ it "can transform 12345678 into english words in double-digit groups" do
953
+ "12345678".en.numwords( :group => 2 ).should == "twelve, thirty-four, fifty-six, seventy-eight"
954
+ end
955
+
956
+ it "can transform 12345678 into english words in triple-digit groups" do
957
+ "12345678".en.numwords( :group => 3 ).should == "one twenty-three, four fifty-six, seventy-eight"
958
+ end
959
+
960
+
961
+ it "can transform the english words for 12345678 into an ordinal" do
962
+ "12345678".en.numwords.en.ordinal.should == "twelve million, three hundred and forty-five thousand, six hundred and seventy-eighth"
963
+ end
964
+
965
+
966
+ it "can transform 12_345_678 into english words" do
967
+ "12_345_678".en.numwords.should == "twelve million, three hundred and forty-five thousand, six hundred and seventy-eight"
968
+ end
969
+
970
+ it "can transform 12_345_678 into english words in single-digit groups" do
971
+ "12_345_678".en.numwords( :group => 1 ).should == "one, two, three, four, five, six, seven, eight"
972
+ end
973
+
974
+ it "can transform 12_345_678 into english words in double-digit groups" do
975
+ "12_345_678".en.numwords( :group => 2 ).should == "twelve, thirty-four, fifty-six, seventy-eight"
976
+ end
977
+
978
+ it "can transform 12_345_678 into english words in triple-digit groups" do
979
+ "12_345_678".en.numwords( :group => 3 ).should == "one twenty-three, four fifty-six, seventy-eight"
980
+ end
981
+
982
+
983
+ it "can transform 1234,5678 into english words" do
984
+ "1234,5678".en.numwords.should == "twelve million, three hundred and forty-five thousand, six hundred and seventy-eight"
985
+ end
986
+
987
+ it "can transform 1234,5678 into english words in single-digit groups" do
988
+ "1234,5678".en.numwords( :group => 1 ).should == "one, two, three, four, five, six, seven, eight"
989
+ end
990
+
991
+ it "can transform 1234,5678 into english words in double-digit groups" do
992
+ "1234,5678".en.numwords( :group => 2 ).should == "twelve, thirty-four, fifty-six, seventy-eight"
993
+ end
994
+
995
+ it "can transform 1234,5678 into english words in triple-digit groups" do
996
+ "1234,5678".en.numwords( :group => 3 ).should == "one twenty-three, four fifty-six, seventy-eight"
997
+ end
998
+
999
+
1000
+ it "can transform 1234567890 into english words" do
1001
+ "1234567890".en.numwords.should == "one billion, two hundred and thirty-four million, five hundred and sixty-seven thousand, eight hundred and ninety"
1002
+ end
1003
+
1004
+ it "can transform 1234567890 into english words in single-digit groups" do
1005
+ "1234567890".en.numwords( :group => 1 ).should == "one, two, three, four, five, six, seven, eight, nine, zero"
1006
+ end
1007
+
1008
+ it "can transform 1234567890 into english words in double-digit groups" do
1009
+ "1234567890".en.numwords( :group => 2 ).should == "twelve, thirty-four, fifty-six, seventy-eight, ninety"
1010
+ end
1011
+
1012
+ it "can transform 1234567890 into english words in triple-digit groups" do
1013
+ "1234567890".en.numwords( :group => 3 ).should == "one twenty-three, four fifty-six, seven eighty-nine, zero"
1014
+ end
1015
+
1016
+
1017
+ it "can transform the english words for 1234567890 into an ordinal" do
1018
+ "1234567890".en.numwords.en.ordinal.should == "one billion, two hundred and thirty-four million, five hundred and sixty-seven thousand, eight hundred and ninetieth"
1019
+ end
1020
+
1021
+
1022
+ it "can transform 123456789012345 into english words" do
1023
+ "123456789012345".en.numwords.should == "one hundred and twenty-three trillion, four hundred and fifty-six billion, seven hundred and eighty-nine million, twelve thousand, three hundred and forty-five"
1024
+ end
1025
+
1026
+ it "can transform 123456789012345 into english words in single-digit groups" do
1027
+ "123456789012345".en.numwords( :group => 1 ).should == "one, two, three, four, five, six, seven, eight, nine, zero, one, two, three, four, five"
1028
+ end
1029
+
1030
+ it "can transform 123456789012345 into english words in double-digit groups" do
1031
+ "123456789012345".en.numwords( :group => 2 ).should == "twelve, thirty-four, fifty-six, seventy-eight, ninety, twelve, thirty-four, five"
1032
+ end
1033
+
1034
+ it "can transform 123456789012345 into english words in triple-digit groups" do
1035
+ "123456789012345".en.numwords( :group => 3 ).should == "one twenty-three, four fifty-six, seven eighty-nine, zero twelve, three forty-five"
1036
+ end
1037
+
1038
+
1039
+ it "can transform the english words for 123456789012345 into an ordinal" do
1040
+ "123456789012345".en.numwords.en.ordinal.should == "one hundred and twenty-three trillion, four hundred and fifty-six billion, seven hundred and eighty-nine million, twelve thousand, three hundred and forty-fifth"
1041
+ end
1042
+
1043
+
1044
+ it "can transform 12345678901234567890 into english words" do
1045
+ "12345678901234567890".en.numwords.should == "twelve quintillion, three hundred and forty-five quadrillion, six hundred and seventy-eight trillion, nine hundred and one billion, two hundred and thirty-four million, five hundred and sixty-seven thousand, eight hundred and ninety"
1046
+ end
1047
+
1048
+ it "can transform 12345678901234567890 into english words in single-digit groups" do
1049
+ "12345678901234567890".en.numwords( :group => 1 ).should == "one, two, three, four, five, six, seven, eight, nine, zero, one, two, three, four, five, six, seven, eight, nine, zero"
1050
+ end
1051
+
1052
+ it "can transform 12345678901234567890 into english words in double-digit groups" do
1053
+ "12345678901234567890".en.numwords( :group => 2 ).should == "twelve, thirty-four, fifty-six, seventy-eight, ninety, twelve, thirty-four, fifty-six, seventy-eight, ninety"
1054
+ end
1055
+
1056
+ it "can transform 12345678901234567890 into english words in triple-digit groups" do
1057
+ "12345678901234567890".en.numwords( :group => 3 ).should == "one twenty-three, four fifty-six, seven eighty-nine, zero twelve, three forty-five, six seventy-eight, ninety"
1058
+ end
1059
+
1060
+
1061
+ it "can transform the english words for 12345678901234567890 into an ordinal" do
1062
+ "12345678901234567890".en.numwords.en.ordinal.should == "twelve quintillion, three hundred and forty-five quadrillion, six hundred and seventy-eight trillion, nine hundred and one billion, two hundred and thirty-four million, five hundred and sixty-seven thousand, eight hundred and ninetieth"
1063
+ end
1064
+
1065
+
1066
+ it "can transform 0.987654 into english words" do
1067
+ "0.987654".en.numwords.should == "zero point nine eight seven six five four"
1068
+ end
1069
+
1070
+ it "can transform 0.987654 into english words in single-digit groups" do
1071
+ "0.987654".en.numwords( :group => 1 ).should == "zero, point, nine, eight, seven, six, five, four"
1072
+ end
1073
+
1074
+ it "can transform 0.987654 into english words in double-digit groups" do
1075
+ "0.987654".en.numwords( :group => 2 ).should == "zero, point, ninety-eight, seventy-six, fifty-four"
1076
+ end
1077
+
1078
+ it "can transform 0.987654 into english words in triple-digit groups" do
1079
+ "0.987654".en.numwords( :group => 3 ).should == "zero, point, nine eighty-seven, six fifty-four"
1080
+ end
1081
+
1082
+
1083
+ it "can transform the english words for 0.987654 into an ordinal" do
1084
+ "0.987654".en.numwords.en.ordinal.should == "zero point nine eight seven six five fourth"
1085
+ end
1086
+
1087
+
1088
+ it "can transform .987654 into english words" do
1089
+ ".987654".en.numwords.should == "point nine eight seven six five four"
1090
+ end
1091
+
1092
+ it "can transform .987654 into english words in single-digit groups" do
1093
+ ".987654".en.numwords( :group => 1 ).should == "point, nine, eight, seven, six, five, four"
1094
+ end
1095
+
1096
+ it "can transform .987654 into english words in double-digit groups" do
1097
+ ".987654".en.numwords( :group => 2 ).should == "point, ninety-eight, seventy-six, fifty-four"
1098
+ end
1099
+
1100
+ it "can transform .987654 into english words in triple-digit groups" do
1101
+ ".987654".en.numwords( :group => 3 ).should == "point, nine eighty-seven, six fifty-four"
1102
+ end
1103
+
1104
+
1105
+ it "can transform the english words for .987654 into an ordinal" do
1106
+ ".987654".en.numwords.en.ordinal.should == "point nine eight seven six five fourth"
1107
+ end
1108
+
1109
+
1110
+ it "can transform 9.87654 into english words" do
1111
+ "9.87654".en.numwords.should == "nine point eight seven six five four"
1112
+ end
1113
+
1114
+ it "can transform 9.87654 into english words in single-digit groups" do
1115
+ "9.87654".en.numwords( :group => 1 ).should == "nine, point, eight, seven, six, five, four"
1116
+ end
1117
+
1118
+ it "can transform 9.87654 into english words in double-digit groups" do
1119
+ "9.87654".en.numwords( :group => 2 ).should == "nine, point, eighty-seven, sixty-five, four"
1120
+ end
1121
+
1122
+ it "can transform 9.87654 into english words in triple-digit groups" do
1123
+ "9.87654".en.numwords( :group => 3 ).should == "nine, point, eight seventy-six, fifty-four"
1124
+ end
1125
+
1126
+
1127
+ it "can transform the english words for 9.87654 into an ordinal" do
1128
+ "9.87654".en.numwords.en.ordinal.should == "nine point eight seven six five fourth"
1129
+ end
1130
+
1131
+
1132
+ it "can transform 98.7654 into english words" do
1133
+ "98.7654".en.numwords.should == "ninety-eight point seven six five four"
1134
+ end
1135
+
1136
+ it "can transform 98.7654 into english words in single-digit groups" do
1137
+ "98.7654".en.numwords( :group => 1 ).should == "nine, eight, point, seven, six, five, four"
1138
+ end
1139
+
1140
+ it "can transform 98.7654 into english words in double-digit groups" do
1141
+ "98.7654".en.numwords( :group => 2 ).should == "ninety-eight, point, seventy-six, fifty-four"
1142
+ end
1143
+
1144
+ it "can transform 98.7654 into english words in triple-digit groups" do
1145
+ "98.7654".en.numwords( :group => 3 ).should == "ninety-eight, point, seven sixty-five, four"
1146
+ end
1147
+
1148
+
1149
+ it "can transform the english words for 98.7654 into an ordinal" do
1150
+ "98.7654".en.numwords.en.ordinal.should == "ninety-eight point seven six five fourth"
1151
+ end
1152
+
1153
+
1154
+ it "can transform 987.654 into english words" do
1155
+ "987.654".en.numwords.should == "nine hundred and eighty-seven point six five four"
1156
+ end
1157
+
1158
+ it "can transform 987.654 into english words in single-digit groups" do
1159
+ "987.654".en.numwords( :group => 1 ).should == "nine, eight, seven, point, six, five, four"
1160
+ end
1161
+
1162
+ it "can transform 987.654 into english words in double-digit groups" do
1163
+ "987.654".en.numwords( :group => 2 ).should == "ninety-eight, seven, point, sixty-five, four"
1164
+ end
1165
+
1166
+ it "can transform 987.654 into english words in triple-digit groups" do
1167
+ "987.654".en.numwords( :group => 3 ).should == "nine eighty-seven, point, six fifty-four"
1168
+ end
1169
+
1170
+
1171
+ it "can transform the english words for 987.654 into an ordinal" do
1172
+ "987.654".en.numwords.en.ordinal.should == "nine hundred and eighty-seven point six five fourth"
1173
+ end
1174
+
1175
+
1176
+ it "can transform 9876.54 into english words" do
1177
+ "9876.54".en.numwords.should == "nine thousand, eight hundred and seventy-six point five four"
1178
+ end
1179
+
1180
+ it "can transform 9876.54 into english words in single-digit groups" do
1181
+ "9876.54".en.numwords( :group => 1 ).should == "nine, eight, seven, six, point, five, four"
1182
+ end
1183
+
1184
+ it "can transform 9876.54 into english words in double-digit groups" do
1185
+ "9876.54".en.numwords( :group => 2 ).should == "ninety-eight, seventy-six, point, fifty-four"
1186
+ end
1187
+
1188
+ it "can transform 9876.54 into english words in triple-digit groups" do
1189
+ "9876.54".en.numwords( :group => 3 ).should == "nine eighty-seven, six, point, fifty-four"
1190
+ end
1191
+
1192
+
1193
+ it "can transform the english words for 9876.54 into an ordinal" do
1194
+ "9876.54".en.numwords.en.ordinal.should == "nine thousand, eight hundred and seventy-six point five fourth"
1195
+ end
1196
+
1197
+
1198
+ it "can transform 98765.4 into english words" do
1199
+ "98765.4".en.numwords.should == "ninety-eight thousand, seven hundred and sixty-five point four"
1200
+ end
1201
+
1202
+ it "can transform 98765.4 into english words in single-digit groups" do
1203
+ "98765.4".en.numwords( :group => 1 ).should == "nine, eight, seven, six, five, point, four"
1204
+ end
1205
+
1206
+ it "can transform 98765.4 into english words in double-digit groups" do
1207
+ "98765.4".en.numwords( :group => 2 ).should == "ninety-eight, seventy-six, five, point, four"
1208
+ end
1209
+
1210
+ it "can transform 98765.4 into english words in triple-digit groups" do
1211
+ "98765.4".en.numwords( :group => 3 ).should == "nine eighty-seven, sixty-five, point, four"
1212
+ end
1213
+
1214
+
1215
+ it "can transform the english words for 98765.4 into an ordinal" do
1216
+ "98765.4".en.numwords.en.ordinal.should == "ninety-eight thousand, seven hundred and sixty-five point fourth"
1217
+ end
1218
+
1219
+
1220
+ it "can transform 101.202.303 into english words" do
1221
+ "101.202.303".en.numwords.should == "one hundred and one point two zero two three zero three"
1222
+ end
1223
+
1224
+ it "can transform 101.202.303 into english words in single-digit groups" do
1225
+ "101.202.303".en.numwords( :group => 1 ).should == "one, zero, one, point, two, zero, two, point, three, zero, three"
1226
+ end
1227
+
1228
+ it "can transform 101.202.303 into english words in double-digit groups" do
1229
+ "101.202.303".en.numwords( :group => 2 ).should == "ten, one, point, twenty, two, point, thirty, three"
1230
+ end
1231
+
1232
+ it "can transform 101.202.303 into english words in triple-digit groups" do
1233
+ "101.202.303".en.numwords( :group => 3 ).should == "one zero one, point, two zero two, point, three zero three"
1234
+ end
1235
+ end
1236
+
1237
+
1238
+ describe "quantification" do
1239
+ it "quantifies 0 objects as 'no'" do
1240
+ "driver".en.quantify( 0 ).should == 'no drivers'
1241
+ end
1242
+
1243
+ it "quantifies 1 object as 'a'" do
1244
+ "driver".en.quantify( 1 ).should == 'a driver'
1245
+ end
1246
+
1247
+ it "quantifies 1 object that starts with a vowel sound as 'an'" do
1248
+ "hour".en.quantify( 1 ).should == 'an hour'
1249
+ end
1250
+
1251
+ it "quantifies 2-5 objects as 'several'" do
1252
+ "driver".en.quantify( 4 ).should == 'several drivers'
1253
+ end
1254
+
1255
+ it "quantifies 6-19 objects as 'a number of'" do
1256
+ "driver".en.quantify( 11 ).should == 'a number of drivers'
1257
+ end
1258
+
1259
+ it "quantifies 20-45 objects as 'numerous'" do
1260
+ "driver".en.quantify( 41 ).should == 'numerous drivers'
1261
+ end
1262
+
1263
+ it "quantifies 46-99 objects as 'many'" do
1264
+ "driver".en.quantify( 58 ).should == 'many drivers'
1265
+ end
1266
+
1267
+ it "quantifies 100-999 objects as 'hundreds of'" do
1268
+ "driver".en.quantify( 318 ).should == 'hundreds of drivers'
1269
+ end
1270
+
1271
+ it "quantifies 1000-9999 objects as 'thousands of'" do
1272
+ "driver".en.quantify( 4158 ).should == 'thousands of drivers'
1273
+ end
1274
+
1275
+ it "quantifies 10000-99999 objects as 'tens of thousands of'" do
1276
+ "driver".en.quantify( 14158 ).should == 'tens of thousands of drivers'
1277
+ end
1278
+
1279
+ it "quantifies 100000-999999 objects as 'hundreds of thousands of'" do
1280
+ "driver".en.quantify( 614158 ).should == 'hundreds of thousands of drivers'
1281
+ end
1282
+
1283
+ it "quantifies 2.6M objects as 'millions of'" do
1284
+ "driver".en.quantify( 2614158 ).should == 'millions of drivers'
1285
+ end
1286
+
1287
+ it "quantifies 8.122B objects as 'billions of'" do
1288
+ "driver".en.quantify( 8122614158 ).should == 'billions of drivers'
1289
+ end
1290
+
1291
+
1292
+ end
1293
+
1294
+ end
1295
+