-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.rb
52 lines (40 loc) · 991 Bytes
/
app.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# class Sentiment
# attr_accessor :value, :confidence
# def initialize(value, confidence)
# @value = value
# @confidence = confidence
# end
# def score
# confidence * value
# end
# end
require_relative "tweet_generator"
class Tweet #done?
attr_accessor :value, :confidence
attr_reader :content, :sentiment
def initialize(args)
@content = args[:text]
@sentiment = args[:sentiment]
@value = nil
@confidence = nil
end
def self.from_tweet(text, sentiment = nil)
# raise ArgumentError unless sentiment.is_a? Sentiment
self.new(text: text, sentiment: sentiment)
end
def score
confidence * value.floor
end
end
# ---------------------------
class Viewer
def self.run!
puts "Please enter a movie:"
input = gets.chomp
puts "\n"
puts TweetGenerator.generate_tweets(input)
end
end
Viewer.run!
# iterate over scored tweets, get rid of zeros before making
# total and using info to generate string for user