Class: EmployMe::Parser::Technologies::Strategies::PatternMatch

Inherits:
Object
  • Object
show all
Defined in:
lib/employ_me/parser/technologies/strategies/pattern_match.rb

Class Method Summary collapse

Class Method Details

.perform(root_node) ⇒ Object

Return Set of technologies



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
# File 'lib/employ_me/parser/technologies/strategies/pattern_match.rb', line 7

def self.perform(root_node)
  technologies = Set.new

  tree = [root_node]

  # Depth First Search
  while tree.size > 0
    curr_node = tree.shift

    if curr_node.children.all? { |child| child.name == "comment" || child.name == 'text' }
      curr_node_text = curr_node.text

      # .NET
      regex = Regexp.new('\\.NET', Regexp::IGNORECASE)
      technologies.add(:dotnet) if regex.match(curr_node_text)

      # Airflow
      regex = Regexp.new('Airflow', Regexp::IGNORECASE)
      technologies.add(:airflow) if regex.match(curr_node_text)

      # Android
      regex = Regexp.new('Android', Regexp::IGNORECASE)
      technologies.add(:android) if regex.match(curr_node_text)

      # AWS
      regex = Regexp.new('AWS', Regexp::IGNORECASE)
      technologies.add(:aws) if regex.match(curr_node_text)

      # CSS
      # regex = Regexp.new('CSS', Regexp::IGNORECASE)
      # technologies.add(:css) if regex.match(curr_node_text)

      # Docker
      regex = Regexp.new('Docker', Regexp::IGNORECASE)
      technologies.add(:docker) if regex.match(curr_node_text)

      # Flink
      regex = Regexp.new('Flink', Regexp::IGNORECASE)
      technologies.add(:flink) if regex.match(curr_node_text)

      # Firestore
      regex = Regexp.new('Firestore', Regexp::IGNORECASE)
      technologies.add(:firestore) if regex.match(curr_node_text)

      # GCP
      regex = Regexp.new('GCP', Regexp::IGNORECASE)
      technologies.add(:gcp) if regex.match(curr_node_text)

      # Helm
      regex = Regexp.new('Helm', Regexp::IGNORECASE)
      technologies.add(:helm) if regex.match(curr_node_text)

      # HTML
      # regex = Regexp.new('HTML', Regexp::IGNORECASE)
      # technologies.add(:html) if regex.match(curr_node_text)

      # iOS
      regex = Regexp.new('iOS', Regexp::IGNORECASE)
      technologies.add(:ios) if regex.match(curr_node_text)

      # Istio
      regex = Regexp.new('Istio', Regexp::IGNORECASE)
      technologies.add(:istio) if regex.match(curr_node_text)

      # Kafka
      regex = Regexp.new('Kafka', Regexp::IGNORECASE)
      technologies.add(:kafka) if regex.match(curr_node_text)

      # Karpenter
      regex = Regexp.new('Karpenter', Regexp::IGNORECASE)
      technologies.add(:karpenter) if regex.match(curr_node_text)

      # Kubeflow
      regex = Regexp.new('Kubeflow', Regexp::IGNORECASE)
      technologies.add(:kubeflow) if regex.match(curr_node_text)

      # Kubernetes
      regex = Regexp.new('Kubernetes', Regexp::IGNORECASE)
      technologies.add(:kubernetes) if regex.match(curr_node_text)

      # Linux
      regex = Regexp.new('Linux', Regexp::IGNORECASE)
      technologies.add(:linux) if regex.match(curr_node_text)

      # Node
      regex = Regexp.new('Node', Regexp::IGNORECASE)
      technologies.add(:node) if regex.match(curr_node_text)

      # PostgreSQL
      regex = Regexp.new('Postgres', Regexp::IGNORECASE)
      technologies.add(:postgresql) if regex.match(curr_node_text)

      regex = Regexp.new('PostgreSQL', Regexp::IGNORECASE)
      technologies.add(:postgresql) if regex.match(curr_node_text)

      # Pulsar
      regex = Regexp.new('Pulsar', Regexp::IGNORECASE)
      technologies.add(:pulsar) if regex.match(curr_node_text)

      # React
      regex = Regexp.new('React', Regexp::IGNORECASE)
      technologies.add(:react) if regex.match(curr_node_text)

      # Redux
      regex = Regexp.new('Redux', Regexp::IGNORECASE)
      technologies.add(:redux) if regex.match(curr_node_text)

      # Ruby on Rails
      regex = Regexp.new('Ruby on Rails', Regexp::IGNORECASE)
      technologies.add(:ruby_on_rails) if regex.match(curr_node_text)

      # Snowflake
      regex = Regexp.new('Snowflake', Regexp::IGNORECASE)
      technologies.add(:snowflake) if regex.match(curr_node_text)

      # Spark
      regex = Regexp.new('Spark', Regexp::IGNORECASE)
      technologies.add(:spark) if regex.match(curr_node_text)

      # Tensorflow
      regex = Regexp.new('Tensorflow', Regexp::IGNORECASE)
      technologies.add(:tensorflow) if regex.match(curr_node_text)

      # Terraform
      regex = Regexp.new('Terraform', Regexp::IGNORECASE)
      technologies.add(:terraform) if regex.match(curr_node_text)

      # Typescript
      regex = Regexp.new('Typescript', Regexp::IGNORECASE)
      technologies.add(:typescript) if regex.match(curr_node_text)
    end

    tree.concat(curr_node.children)
  end

  technologies
end