secret_agent_noun 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +41 -0
- data/db/verbs_to_agent_nouns.yml +2192 -0
- data/lib/check_for_duplicates.rb +11 -0
- data/lib/secret_agent_noun.rb +31 -0
- metadata +68 -0
@@ -0,0 +1,11 @@
|
|
1
|
+
file = File.expand_path('../../db/verbs_to_agent_nouns.yml', __FILE__)
|
2
|
+
pairs = File.read(file).split("\n").map { |l| l.split(': ') }
|
3
|
+
verbs = pairs.map(&:first)
|
4
|
+
agent_nouns = pairs.map(&:last)
|
5
|
+
|
6
|
+
find_duplicates = ->(ary) { ary.select { |e| ary.count(e) > 1 }.uniq }
|
7
|
+
|
8
|
+
duplicates = find_duplicates.call(verbs)
|
9
|
+
duplicates += find_duplicates.call(agent_nouns)
|
10
|
+
|
11
|
+
puts duplicates
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
module SecretAgentNoun
|
4
|
+
class << self
|
5
|
+
def agent_noun(verb)
|
6
|
+
lookup[normalize(verb)]
|
7
|
+
end
|
8
|
+
|
9
|
+
def verb(agent_noun)
|
10
|
+
inverse_lookup[normalize(agent_noun)]
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def yaml_file
|
16
|
+
File.expand_path('../../db/verbs_to_agent_nouns.yml', __FILE__)
|
17
|
+
end
|
18
|
+
|
19
|
+
def lookup
|
20
|
+
@lookup ||= YAML.load_file(yaml_file)
|
21
|
+
end
|
22
|
+
|
23
|
+
def inverse_lookup
|
24
|
+
@inverse_lookup ||= lookup.invert
|
25
|
+
end
|
26
|
+
|
27
|
+
def normalize(input)
|
28
|
+
input.to_s.downcase
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: secret_agent_noun
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Max White
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.1'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 3.1.0
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.1'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 3.1.0
|
33
|
+
description:
|
34
|
+
email: mushishi78@gmail.com
|
35
|
+
executables: []
|
36
|
+
extensions: []
|
37
|
+
extra_rdoc_files: []
|
38
|
+
files:
|
39
|
+
- LICENSE.txt
|
40
|
+
- README.md
|
41
|
+
- db/verbs_to_agent_nouns.yml
|
42
|
+
- lib/check_for_duplicates.rb
|
43
|
+
- lib/secret_agent_noun.rb
|
44
|
+
homepage:
|
45
|
+
licenses:
|
46
|
+
- MIT
|
47
|
+
metadata: {}
|
48
|
+
post_install_message:
|
49
|
+
rdoc_options: []
|
50
|
+
require_paths:
|
51
|
+
- lib
|
52
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
requirements: []
|
63
|
+
rubyforge_project:
|
64
|
+
rubygems_version: 2.2.2
|
65
|
+
signing_key:
|
66
|
+
specification_version: 4
|
67
|
+
summary: Verb to agent noun inflector
|
68
|
+
test_files: []
|