forked from abishekk92/jarvis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
classifier.rb
30 lines (29 loc) · 819 Bytes
/
classifier.rb
1
2
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
require_relative './custom_string'
class Classifier
def self.classify_category(noun_phrases)
classified_category=''
depth=0
classified=false
until depth == noun_phrases.length or classified
if noun_phrases[depth].is_weather?
classified_category='weather'
classified=true
elsif noun_phrases[depth].is_restaurant?
classified_category='restaurant'
classified=true
elsif noun_phrases[depth].is_cricket?
classified_category='cricket'
classified=true
elsif noun_phrases[depth].is_football?
classified_category='football'
classified=true
elsif noun_phrases[depth].is_command?
classified_category='command'
classified=true
else
depth=depth+1
end
end
classified_category
end
end