proper_caser 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/Gemfile +10 -0
- data/Guardfile +8 -0
- data/LICENSE +22 -0
- data/README.md +44 -0
- data/Rakefile +11 -0
- data/lib/proper_caser.rb +28 -0
- data/lib/proper_caser/version.rb +3 -0
- data/proper_caser.gemspec +19 -0
- data/spec/fixtures/IAMA.yml +1262 -0
- data/spec/fixtures/ios.yml +1169 -0
- data/spec/lib/proper_caser_spec.rb +38 -0
- data/spec/spec_helper.rb +17 -0
- metadata +85 -0
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require File.expand_path('lib/proper_caser')
|
3
|
+
|
4
|
+
describe ProperCaser do
|
5
|
+
describe '#best_guess' do
|
6
|
+
it 'returns the match with the highest number of results' do
|
7
|
+
VCR.use_cassette('ios') do
|
8
|
+
ProperCaser.best_guess('IOS').should == 'iOS'
|
9
|
+
end
|
10
|
+
|
11
|
+
VCR.use_cassette('IAMA') do
|
12
|
+
ProperCaser.best_guess('IAMA').should == 'IAMA'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe '#capitalization_counts' do
|
18
|
+
it 'returns a hash of possible capitalizations and their counts' do
|
19
|
+
VCR.use_cassette('ios') do
|
20
|
+
ProperCaser.capitalization_counts('IOS').should == {
|
21
|
+
"iOS" => 54,
|
22
|
+
"Ios" => 19,
|
23
|
+
"IOS" => 10,
|
24
|
+
"ios" => 10
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
VCR.use_cassette('IAMA') do
|
29
|
+
ProperCaser.capitalization_counts('IAMA').should == {
|
30
|
+
"IAMA" => 38,
|
31
|
+
"IAmA" => 9,
|
32
|
+
"iama" => 2,
|
33
|
+
"Iama" => 2
|
34
|
+
}
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# Require this file using `require "spec_helper.rb"` to ensure that it is only
|
4
|
+
# loaded once.
|
5
|
+
#
|
6
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
|
+
RSpec.configure do |config|
|
8
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
9
|
+
config.run_all_when_everything_filtered = true
|
10
|
+
config.filter_run :focus
|
11
|
+
end
|
12
|
+
|
13
|
+
require 'vcr'
|
14
|
+
VCR.configure do |c|
|
15
|
+
c.cassette_library_dir = 'spec/fixtures'
|
16
|
+
c.hook_into :webmock
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: proper_caser
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Jeffrey Chupp
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-06-18 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: google-search
|
16
|
+
requirement: &70179271386440 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.0.2
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70179271386440
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: nokogiri
|
27
|
+
requirement: &70179271385940 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.5.3
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70179271385940
|
36
|
+
description: Get educated guesses about proper capitalization of words and phrases
|
37
|
+
email:
|
38
|
+
- jeff@semanticart.com
|
39
|
+
executables: []
|
40
|
+
extensions: []
|
41
|
+
extra_rdoc_files: []
|
42
|
+
files:
|
43
|
+
- .gitignore
|
44
|
+
- .rspec
|
45
|
+
- Gemfile
|
46
|
+
- Guardfile
|
47
|
+
- LICENSE
|
48
|
+
- README.md
|
49
|
+
- Rakefile
|
50
|
+
- lib/proper_caser.rb
|
51
|
+
- lib/proper_caser/version.rb
|
52
|
+
- proper_caser.gemspec
|
53
|
+
- spec/fixtures/IAMA.yml
|
54
|
+
- spec/fixtures/ios.yml
|
55
|
+
- spec/lib/proper_caser_spec.rb
|
56
|
+
- spec/spec_helper.rb
|
57
|
+
homepage: https://github.com/terriblelabs/proper_caser
|
58
|
+
licenses: []
|
59
|
+
post_install_message:
|
60
|
+
rdoc_options: []
|
61
|
+
require_paths:
|
62
|
+
- lib
|
63
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
71
|
+
requirements:
|
72
|
+
- - ! '>='
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
requirements: []
|
76
|
+
rubyforge_project:
|
77
|
+
rubygems_version: 1.8.16
|
78
|
+
signing_key:
|
79
|
+
specification_version: 3
|
80
|
+
summary: Leverage google search to clean up poor capitalization in dirty data
|
81
|
+
test_files:
|
82
|
+
- spec/fixtures/IAMA.yml
|
83
|
+
- spec/fixtures/ios.yml
|
84
|
+
- spec/lib/proper_caser_spec.rb
|
85
|
+
- spec/spec_helper.rb
|