text 1.2.3 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,17 +1,17 @@
1
- require "test_helper"
1
+ require_relative "./test_helper"
2
2
  require "text/metaphone"
3
3
  require 'yaml'
4
4
 
5
5
  class MetaphoneTest < Test::Unit::TestCase
6
6
 
7
7
  def test_cases
8
- YAML.load(data_file('metaphone.txt')).each do |input, expected_output|
8
+ YAML.load(data_file('metaphone.yml')).each do |input, expected_output|
9
9
  assert_equal expected_output, Text::Metaphone.metaphone(input)
10
10
  end
11
11
  end
12
12
 
13
13
  def test_cases_for_buggy_implementation
14
- YAML.load(data_file('metaphone_buggy.txt')).each do |input, expected_output|
14
+ YAML.load(data_file('metaphone_buggy.yml')).each do |input, expected_output|
15
15
  assert_equal expected_output, Text::Metaphone.metaphone(input, :buggy=>true)
16
16
  end
17
17
  end
@@ -1,4 +1,4 @@
1
- require "test_helper"
1
+ require_relative "./test_helper"
2
2
  require "text/porter_stemming"
3
3
 
4
4
  class PorterStemmingTest < Test::Unit::TestCase
@@ -1,28 +1,20 @@
1
- require "test_helper"
1
+ require_relative "./test_helper"
2
2
  require "text/soundex"
3
3
  require 'yaml'
4
4
 
5
5
  class SoundexTest < Test::Unit::TestCase
6
6
 
7
7
  def test_cases
8
- YAML.load(%{
9
-
10
- Euler: E460
11
- Ellery: E460
12
- Gauss: G200
13
- Ghosh: G200
14
- Hilbert: H416
15
- Heilbronn: H416
16
- Knuth: K530
17
- Kant: K530
18
- Lloyd: L300
19
- Ladd: L300
20
- Lukasiewicz: L222
21
- Lissajous: L222
22
-
23
- }).each do |input, expected_output|
8
+ YAML.load(data_file('soundex.yml')).each do |input, expected_output|
24
9
  assert_equal expected_output, Text::Soundex.soundex(input)
25
10
  end
26
11
  end
27
12
 
13
+ def test_should_return_nil_for_empty_string
14
+ assert_nil Text::Soundex.soundex("")
15
+ end
16
+
17
+ def test_should_return_nil_for_string_with_no_letters
18
+ assert_nil Text::Soundex.soundex("!@#123")
19
+ end
28
20
  end
@@ -1,4 +1,4 @@
1
- require 'test_helper'
1
+ require_relative "./test_helper"
2
2
 
3
3
  class TextTest < Test::Unit::TestCase
4
4
  def test_should_load_all_components
@@ -1,4 +1,4 @@
1
- require "test_helper"
1
+ require_relative "./test_helper"
2
2
  require "text/white_similarity"
3
3
 
4
4
  class WhiteSimilarityTest < Test::Unit::TestCase
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: text
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 1.2.3
4
+ version: 1.3.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Paul Battley
@@ -11,80 +10,78 @@ authors:
11
10
  autorequire:
12
11
  bindir: bin
13
12
  cert_chain: []
14
- date: 2013-08-27 00:00:00.000000000 Z
13
+ date: 2014-06-23 00:00:00.000000000 Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
- type: :development
18
- version_requirements: !ruby/object:Gem::Requirement
16
+ name: rake
17
+ requirement: !ruby/object:Gem::Requirement
19
18
  requirements:
20
- - - ! '>='
19
+ - - "~>"
21
20
  - !ruby/object:Gem::Version
22
- version: '0'
23
- none: false
21
+ version: '10.0'
22
+ type: :development
24
23
  prerelease: false
25
- name: rake
26
- requirement: !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
27
25
  requirements:
28
- - - ! '>='
26
+ - - "~>"
29
27
  - !ruby/object:Gem::Version
30
- version: '0'
31
- none: false
32
- description: ! 'A collection of text algorithms: Levenshtein, Soundex, Metaphone,
33
- Double Metaphone, Porter Stemming'
28
+ version: '10.0'
29
+ description: 'A collection of text algorithms: Levenshtein, Soundex, Metaphone, Double
30
+ Metaphone, Porter Stemming'
34
31
  email: pbattley@gmail.com
35
32
  executables: []
36
33
  extensions: []
37
34
  extra_rdoc_files:
38
35
  - README.rdoc
36
+ - COPYING.txt
39
37
  files:
38
+ - COPYING.txt
39
+ - README.rdoc
40
+ - Rakefile
41
+ - lib/text.rb
40
42
  - lib/text/double_metaphone.rb
41
43
  - lib/text/levenshtein.rb
44
+ - lib/text/metaphone.rb
42
45
  - lib/text/porter_stemming.rb
43
46
  - lib/text/soundex.rb
44
47
  - lib/text/version.rb
45
48
  - lib/text/white_similarity.rb
46
- - lib/text/metaphone.rb
47
- - lib/text.rb
48
- - test/data/porter_stemming_output.txt
49
49
  - test/data/double_metaphone.csv
50
- - test/data/metaphone.txt
51
- - test/data/metaphone_buggy.txt
52
- - test/data/big.txt
50
+ - test/data/metaphone.yml
51
+ - test/data/metaphone_buggy.yml
53
52
  - test/data/porter_stemming_input.txt
54
- - test/data/chunky.flf
55
- - test/data/chunky.txt
56
- - test/white_similarity_test.rb
57
- - test/text_test.rb
53
+ - test/data/porter_stemming_output.txt
54
+ - test/data/soundex.yml
55
+ - test/double_metaphone_test.rb
56
+ - test/levenshtein_test.rb
57
+ - test/metaphone_test.rb
58
58
  - test/porter_stemming_test.rb
59
59
  - test/soundex_test.rb
60
- - test/metaphone_test.rb
61
- - test/levenshtein_test.rb
62
60
  - test/test_helper.rb
63
- - README.rdoc
64
- - Rakefile
61
+ - test/text_test.rb
62
+ - test/white_similarity_test.rb
65
63
  homepage: http://github.com/threedaymonk/text
66
64
  licenses:
67
65
  - MIT
66
+ metadata: {}
68
67
  post_install_message:
69
68
  rdoc_options: []
70
69
  require_paths:
71
70
  - lib
72
71
  required_ruby_version: !ruby/object:Gem::Requirement
73
72
  requirements:
74
- - - ! '>='
73
+ - - ">="
75
74
  - !ruby/object:Gem::Version
76
75
  version: '0'
77
- none: false
78
76
  required_rubygems_version: !ruby/object:Gem::Requirement
79
77
  requirements:
80
- - - ! '>='
78
+ - - ">="
81
79
  - !ruby/object:Gem::Version
82
80
  version: '0'
83
- none: false
84
81
  requirements: []
85
82
  rubyforge_project: text
86
- rubygems_version: 1.8.25
83
+ rubygems_version: 2.2.2
87
84
  signing_key:
88
- specification_version: 3
85
+ specification_version: 4
89
86
  summary: A collection of text algorithms
90
87
  test_files: []
@@ -1,8 +0,0 @@
1
- _ _ _ _ __ __ _ _
2
- | | | | | | | \ \ / / | | | |
3
- | |__| | ___| | | ___ \ \ /\ / /__ _ __| | __| |
4
- | __ |/ _ \ | |/ _ \ \ \/ \/ / _ \| '__| |/ _` |
5
- | | | | __/ | | (_) | \ /\ / (_) | | | | (_| |
6
- |_| |_|\___|_|_|\___/ \/ \/ \___/|_| |_|\__,_|
7
-
8
-
@@ -1,512 +0,0 @@
1
- flf2a$ 5 4 20 15 1
2
- Square by Chris Gill, 30-JUN-94 -- based on .sig of Jeb Hagan.
3
- $@
4
- $@
5
- $@
6
- $@
7
- $@@
8
- __ @
9
- | |@
10
- |__|@
11
- |__|@
12
- @@
13
- ____ @
14
- | | |@
15
- |_|_|@
16
- @
17
- @@
18
- _____ @
19
- _| | |_ @
20
- |_ _|@
21
- |_ _|@
22
- |__|__| @@
23
- __,-,__ @
24
- | ' '__|@
25
- |__ |@
26
- |_______|@
27
- |_| @@
28
- __ ___ @
29
- |__| |@
30
- | __|@
31
- |___|__|@
32
- @@
33
- __,-,__ @
34
- | ' '__|@
35
- | __|@
36
- |_______|@
37
- |_| @@
38
- __ @
39
- | |@
40
- |_|@
41
- @
42
- @@
43
- ___ @
44
- ,' _|@
45
- | | @
46
- | |_ @
47
- `.___|@@
48
- ___ @
49
- |_ `.@
50
- | |@
51
- _| |@
52
- |___,'@@
53
- __ _ __ @
54
- | | | |@
55
- > < @
56
- |__|_|__|@
57
- @@
58
- __ @
59
- _| |_ @
60
- |_ _|@
61
- |__| @
62
- @@
63
- @
64
- @
65
- __ @
66
- | |@
67
- |_|@@
68
- @
69
- ______ @
70
- |______|@
71
- @
72
- @@
73
- @
74
- @
75
- __ @
76
- |__|@
77
- @@
78
- ___@
79
- / /@
80
- ,' ,' @
81
- /__/ @
82
- @@
83
- ______ @
84
- | |@
85
- | -- |@
86
- |______|@
87
- @@
88
- ____ @
89
- |_ | @
90
- _| |_ @
91
- |______|@
92
- @@
93
- ______ @
94
- |__ |@
95
- | __|@
96
- |______|@
97
- @@
98
- ______ @
99
- |__ |@
100
- |__ |@
101
- |______|@
102
- @@
103
- _____ @
104
- | | | @
105
- |__ |@
106
- |__| @
107
- @@
108
- ______ @
109
- | __|@
110
- |__ |@
111
- |______|@
112
- @@
113
- ______ @
114
- | __|@
115
- | __ |@
116
- |______|@
117
- @@
118
- ______ @
119
- | |@
120
- |_ |@
121
- |____|@
122
- @@
123
- ______ @
124
- | __ |@
125
- | __ |@
126
- |______|@
127
- @@
128
- ______ @
129
- | __ |@
130
- |__ |@
131
- |______|@
132
- @@
133
- __ @
134
- |__|@
135
- __ @
136
- |__|@
137
- @@
138
- __ @
139
- |__|@
140
- __ @
141
- | |@
142
- |_|@@
143
- __ @
144
- ,' _|@
145
- / / @
146
- \ \_ @
147
- `.__|@@
148
- @
149
- ______ @
150
- |______|@
151
- |______|@
152
- @@
153
- __ @
154
- |_ `. @
155
- \ \@
156
- _/ /@
157
- |__,' @@
158
- _____ @
159
- |__ |@
160
- ', ,-'@
161
- |--| @
162
- '--' @@
163
- _________ @
164
- | ___ |@
165
- | | _ |@
166
- | |______|@
167
- |_________|@@
168
- _______ @
169
- | _ |@
170
- | |@
171
- |___|___|@
172
- @@
173
- ______ @
174
- | __ \@
175
- | __ <@
176
- |______/@
177
- @@
178
- ______ @
179
- | |@
180
- | ---|@
181
- |______|@
182
- @@
183
- _____ @
184
- | \ @
185
- | -- |@
186
- |_____/ @
187
- @@
188
- _______ @
189
- | ___|@
190
- | ___|@
191
- |_______|@
192
- @@
193
- _______ @
194
- | ___|@
195
- | ___|@
196
- |___| @
197
- @@
198
- _______ @
199
- | __|@
200
- | | |@
201
- |_______|@
202
- @@
203
- _______ @
204
- | | |@
205
- | |@
206
- |___|___|@
207
- @@
208
- _______ @
209
- |_ _|@
210
- _| |_ @
211
- |_______|@
212
- @@
213
- _____ @
214
- _| |@
215
- | |@
216
- |_______|@
217
- @@
218
- __ __ @
219
- | |/ |@
220
- | < @
221
- |__|\__|@
222
- @@
223
- _____ @
224
- | |_ @
225
- | |@
226
- |_______|@
227
- @@
228
- _______ @
229
- | | |@
230
- | |@
231
- |__|_|__|@
232
- @@
233
- _______ @
234
- | | |@
235
- | |@
236
- |__|____|@
237
- @@
238
- _______ @
239
- | |@
240
- | - |@
241
- |_______|@
242
- @@
243
- ______ @
244
- | __ \@
245
- | __/@
246
- |___| @
247
- @@
248
- _______ @
249
- | |@
250
- | - _|@
251
- |_______|@
252
- @@
253
- ______ @
254
- | __ \@
255
- | <@
256
- |___|__|@
257
- @@
258
- _______ @
259
- | __|@
260
- |__ |@
261
- |_______|@
262
- @@
263
- _______ @
264
- |_ _|@
265
- | | @
266
- |___| @
267
- @@
268
- _______ @
269
- | | |@
270
- | | |@
271
- |_______|@
272
- @@
273
- ___ ___ @
274
- | | |@
275
- | | |@
276
- \_____/ @
277
- @@
278
- ________ @
279
- | | | |@
280
- | | | |@
281
- |________|@
282
- @@
283
- ___ ___ @
284
- | | |@
285
- |- -|@
286
- |___|___|@
287
- @@
288
- ___ ___ @
289
- | | |@
290
- \ / @
291
- |___| @
292
- @@
293
- _______ @
294
- |__ |@
295
- | __|@
296
- |_______|@
297
- @@
298
- ____ @
299
- | _|@
300
- | | @
301
- | |_ @
302
- |____|@@
303
- ___ @
304
- \ \ @
305
- `. `. @
306
- \__\@
307
- @@
308
- ____ @
309
- |_ |@
310
- | |@
311
- _| |@
312
- |____|@@
313
- ____ @
314
- | |@
315
- |_/\_|@
316
- @
317
- @@
318
- @
319
- @
320
- @
321
- ______ @
322
- |______|@@
323
- __ @
324
- | |@
325
- |_| @
326
- @
327
- @@
328
- @
329
- .---.-.@
330
- | _ |@
331
- |___._|@
332
- @@
333
- __ @
334
- | |--.@
335
- | _ |@
336
- |_____|@
337
- @@
338
- @
339
- .----.@
340
- | __|@
341
- |____|@
342
- @@
343
- __ @
344
- .--| |@
345
- | _ |@
346
- |_____|@
347
- @@
348
- @
349
- .-----.@
350
- | -__|@
351
- |_____|@
352
- @@
353
- ___ @
354
- .' _|@
355
- | _|@
356
- |__| @
357
- @@
358
- @
359
- .-----.@
360
- | _ |@
361
- |___ |@
362
- |_____|@@
363
- __ @
364
- | |--.@
365
- | |@
366
- |__|__|@
367
- @@
368
- __ @
369
- |__|@
370
- | |@
371
- |__|@
372
- @@
373
- __ @
374
- |__|@
375
- | |@
376
- | |@
377
- |___|@@
378
- __ @
379
- | |--.@
380
- | < @
381
- |__|__|@
382
- @@
383
- __ @
384
- | |@
385
- | |@
386
- |__|@
387
- @@
388
- @
389
- .--------.@
390
- | |@
391
- |__|__|__|@
392
- @@
393
- @
394
- .-----.@
395
- | |@
396
- |__|__|@
397
- @@
398
- @
399
- .-----.@
400
- | _ |@
401
- |_____|@
402
- @@
403
- @
404
- .-----.@
405
- | _ |@
406
- | __|@
407
- |__| @@
408
- @
409
- .-----.@
410
- | _ |@
411
- |__ |@
412
- |__|@@
413
- @
414
- .----.@
415
- | _|@
416
- |__| @
417
- @@
418
- @
419
- .-----.@
420
- |__ --|@
421
- |_____|@
422
- @@
423
- __ @
424
- | |_ @
425
- | _|@
426
- |____|@
427
- @@
428
- @
429
- .--.--.@
430
- | | |@
431
- |_____|@
432
- @@
433
- @
434
- .--.--.@
435
- | | |@
436
- \___/ @
437
- @@
438
- @
439
- .--.--.--.@
440
- | | | |@
441
- |________|@
442
- @@
443
- @
444
- .--.--.@
445
- |_ _|@
446
- |__.__|@
447
- @@
448
- @
449
- .--.--.@
450
- | | |@
451
- |___ |@
452
- |_____|@@
453
- @
454
- .-----.@
455
- |-- __|@
456
- |_____|@
457
- @@
458
- ___ @
459
- | _|@
460
- / / @
461
- \ \_ @
462
- |___|@@
463
- __ @
464
- | |@
465
- | |@
466
- | |@
467
- |__|@@
468
- ___ @
469
- |_ | @
470
- \ \@
471
- _/ /@
472
- |___| @@
473
- ___ @
474
- | ' |@
475
- |_,_| @
476
- @
477
- @@
478
- .--.--.@
479
- |-----|@
480
- | - |@
481
- |__|__|@
482
- @@
483
- .--.--.@
484
- |-----|@
485
- | _ |@
486
- |_____|@
487
- @@
488
- .--.--.@
489
- |--|--|@
490
- | | |@
491
- |_____|@
492
- @@
493
- .--.--.@
494
- |---.-|@
495
- | _ |@
496
- |___._|@
497
- @@
498
- .--.--.@
499
- |-----|@
500
- | _ |@
501
- |_____|@
502
- @@
503
- .--.--.@
504
- |--|--|@
505
- | | |@
506
- |_____|@
507
- @@
508
- _______ @
509
- | __ \@
510
- | __ <@
511
- | |____/@
512
- |__| @@