employ_me 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bf37370d3f7bf02eb6cf13e67c6f5c075c1b1082eab6b068202eb057ab79c34f
4
- data.tar.gz: e7d65db11f7260bc26c5fab9e6e2c00c284ec4336b2934171d4958213c19eebf
3
+ metadata.gz: 1813eaad2894ab155c996fa0d4f367daff60858f2b9eecf63fd6d95b742ab4f4
4
+ data.tar.gz: a548d8c649421f6e56353ad9041c3745aec9c96d32b6b50c550aecff6a3754e6
5
5
  SHA512:
6
- metadata.gz: 5ef8e85d23a7a12db2abce764bb26851fcf9ed5c8612790cf5ae37e40ddac4583e1fe603b4dfdbc0dd39d90d2f849339dba4c4ea18dcb123cd8383bf11033405
7
- data.tar.gz: 0c1d0fe3a2748649144c75c24d71f5698b028be3bb3f1e35f70527c68af1256408a28698323b7f4663df74dd37033b80b96dc0e9c395f19f46b43efc0e240fe6
6
+ metadata.gz: 62d89c14f54be3eaab64d5431903b0a31512a347800b1c01245e3db4a0fb2755c8fbe5674acf5baa459c34a3e20f9c92ab76dd18c5d03eea9405337986ec981a
7
+ data.tar.gz: e87268900fc62ff2e5f29d7dc17e1b8c5a45fd9d45f56ef8b52807422c8c3679dbf20bda64d580d4b0204afa0a9526446c7dd5ae8dcfae4b2b5f1a4a6aab7b37
@@ -0,0 +1,76 @@
1
+ module EmployMe
2
+ module Parser
3
+ module Location
4
+ module Strategies
5
+ class PatternMatch
6
+ # Return [state code, city name, state name]
7
+ def self.perform(root_node)
8
+ tree = [root_node]
9
+
10
+ # Depth First Search
11
+ while tree.size > 0
12
+ curr_node = tree.shift
13
+
14
+ if curr_node.children.all? { |child| child.name == "comment" || child.name == 'text' }
15
+ curr_node_text = curr_node.text
16
+
17
+ # Remote Jobs
18
+ regex = Regexp.new('US & Canada Remote', Regexp::IGNORECASE)
19
+ return ['REMOTE', nil, nil] if regex.match(curr_node_text)
20
+
21
+ # San Francisco, CA Jobs
22
+ regex = Regexp.new('San Francisco, CA', Regexp::IGNORECASE)
23
+ return ['CA', 'San Francisco', 'CA'] if regex.match(curr_node_text)
24
+
25
+ # San Mateo, CA Jobs
26
+ regex = Regexp.new('San Mateo, CA', Regexp::IGNORECASE)
27
+ return ['CA', 'San Mateo', 'CA'] if regex.match(curr_node_text)
28
+
29
+ # Boca Raton, FL Jobs
30
+ regex = Regexp.new('Boca Raton, FL', Regexp::IGNORECASE)
31
+ return ['FL', 'Boca Raton', 'FL'] if regex.match(curr_node_text)
32
+
33
+ regex = Regexp.new('Boca Raton, Florida', Regexp::IGNORECASE)
34
+ return ['FL', 'Boca Raton', 'FL'] if regex.match(curr_node_text)
35
+
36
+ regex = Regexp.new('Boca Raton, Florida, United States', Regexp::IGNORECASE)
37
+ return ['FL', 'Boca Raton', 'FL'] if regex.match(curr_node_text)
38
+
39
+ # Raleigh, NC Jobs
40
+ regex = Regexp.new('Raleigh, NC', Regexp::IGNORECASE)
41
+ return ['NC', 'Raleigh', 'NC'] if regex.match(curr_node_text)
42
+
43
+ # New York, NY Jobs
44
+ regex = Regexp.new('New York, NY', Regexp::IGNORECASE)
45
+ return ['NY', 'New York', 'NY'] if regex.match(curr_node_text)
46
+
47
+ regex = Regexp.new('New York, New York', Regexp::IGNORECASE)
48
+ return ['NY', 'New York', 'NY'] if regex.match(curr_node_text)
49
+
50
+ regex = Regexp.new('New York, New York, United States', Regexp::IGNORECASE)
51
+ return ['NY', 'New York', 'NY'] if regex.match(curr_node_text)
52
+
53
+ regex = Regexp.new('New York Office', Regexp::IGNORECASE)
54
+ return ['NY', 'New York', 'NY'] if regex.match(curr_node_text)
55
+
56
+ # Seattle, WA Jobs
57
+ regex = Regexp.new('Seattle, WA', Regexp::IGNORECASE)
58
+ return ['WA', 'Seattle', 'WA'] if regex.match(curr_node_text)
59
+
60
+ regex = Regexp.new('Seattle, Washington', Regexp::IGNORECASE)
61
+ return ['WA', 'Seattle', 'WA'] if regex.match(curr_node_text)
62
+
63
+ regex = Regexp.new('Seattle, Washington, United States', Regexp::IGNORECASE)
64
+ return ['WA', 'Seattle', 'WA'] if regex.match(curr_node_text)
65
+ end
66
+
67
+ tree.concat(curr_node.children)
68
+ end
69
+
70
+ nil
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
data/lib/employ_me.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'employ_me/parser/location/strategies/pattern_match.rb'
1
2
  require 'employ_me/parser/programming_language/strategies/pattern_match.rb'
2
3
  require 'employ_me/parser/salary/strategies/pattern_match.rb'
3
4
  require 'employ_me/parser/title/strategies/pattern_match.rb'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: employ_me
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - dgonzdev
@@ -31,6 +31,7 @@ extensions: []
31
31
  extra_rdoc_files: []
32
32
  files:
33
33
  - lib/employ_me.rb
34
+ - lib/employ_me/parser/location/strategies/pattern_match.rb
34
35
  - lib/employ_me/parser/programming_language/strategies/pattern_match.rb
35
36
  - lib/employ_me/parser/salary/strategies/pattern_match.rb
36
37
  - lib/employ_me/parser/title/strategies/pattern_match.rb