lesser-evil 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 827e9c70e1b44542502e61753718dda0ed7d9e94
4
- data.tar.gz: edf29e00cba12df594007dd25bbb31bc4de963f7
3
+ metadata.gz: 7908aa827f9e75bc14bf3212711fd213d0133a05
4
+ data.tar.gz: bb046caf1d70c37d67ae43c19e84943285e5a235
5
5
  SHA512:
6
- metadata.gz: 85431216b4df0841f1200296213a7febd569c240b5bfdee3b13fe869453d0e5a5bc26e90c678842f154f931691d264e2f0ce654def6679a941f365b9a7fd05d0
7
- data.tar.gz: 5716eac57d4a82dcfede7879be1c7b9b221b875fe3a33bfbf55e849c1b4aa746bb18e2f7c53f61e39ec3c7cfd4d46864aa18965b7f2eb070485119ddea7ec367
6
+ metadata.gz: 7f1b4ea30f73ca89df7b90c43dc34dea1e45a2bcb4f59a6b4dab0499b2199af499a294be3b1766f5f755f82422fd94dae83a7571454b26717081871437986cbc
7
+ data.tar.gz: d4661ae4aab855714c7d65ea5b33c8683f2c96bebdf2362478daa999463492c2d7d2db8a841ed2604ed38b17ff0a7bb2ab0d8a6577581c4a26f0bcce7b5ad270
data/LICENSE ADDED
@@ -0,0 +1,8 @@
1
+ The MIT License (MIT)
2
+ Copyright (c) 2016 Adam Cooper
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5
+
6
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1 +1,18 @@
1
- # lesser-evil-cli-app
1
+ # Lesser Evil
2
+ **Lesser Evil** is a command line gem that allows the user to view tweets around the recent U.S. presidential election. Lesser Evil presents the user with a choice of candidates (Trump and Clinton) and of sentiments (angry or very angry). It then finds recent tweets about the chosen candidate, filters them through a sentiment analysis engine, and returns the angry or very angry tweets to the screen.
3
+
4
+ Lesser Evil uses the [Twitter Search API](https://dev.twitter.com/rest/public/search) and [Vivek Narayanan's sentiment analysis tool](http://sentiment.vivekn.com/about/). Mr Narayanan's tool is not perfect. It returns a value of positive, negative, or neutral for each input text, and also a confidence number between 0 and 100. Sometimes, though, you ask for very angry tweets and what you get is not angry at all.
5
+
6
+ ## Installation
7
+ Installation is simple. Install the gem on your hard drive
8
+
9
+ gem install lesser-evil
10
+ and then run it with the following command:
11
+
12
+ lesser-evil-cli
13
+
14
+ ## Contributors guide
15
+ Go ahead and make a pull request!
16
+
17
+ ## License
18
+ [MIT](https://github.com/amcooper/lesser-evil-cli-app/blob/master/LICENSE)
@@ -4,7 +4,7 @@ class LesserEvil::CommandLineInterface
4
4
  end
5
5
 
6
6
  def intro_display
7
- 20.times { puts }
7
+ 50.times { puts }
8
8
 
9
9
  File.open(File.join(File.dirname(__FILE__), "/../assets/hillary.txt"), "r") do |file|
10
10
  file.readlines.each do |line|
@@ -33,6 +33,8 @@ class LesserEvil::TweetController
33
33
  index = 0
34
34
  while index < batch.length && @result.length < @tweet_qty
35
35
  status = batch[index]
36
+
37
+ # Filter out retweets
36
38
  if status["retweeted_status"] == nil || (!@result.collect {|tweet_slim| tweet_slim.orig_id}.include?(status["retweeted_status"]["id"]) && !@result.collect {|tweet_slim| tweet_slim.orig_id}.include?(status["id"]))
37
39
  sentiment_analysis = get_sentiment(status["text"])
38
40
  intensity = @is_intense ? 1 : 0
@@ -12,8 +12,8 @@ class TweetSlim
12
12
  end
13
13
 
14
14
  def prettyprint
15
- puts @text.white.on_black
16
- puts "@#{@author} #{@timestamp}".blue
15
+ puts @text.light_black
16
+ puts "@#{@author} #{@timestamp}".light_blue
17
17
  end
18
18
 
19
19
  end
@@ -1,5 +1,5 @@
1
1
  module LesserEvil
2
2
 
3
- VERSION = '0.2.2'
3
+ VERSION = '0.2.3'
4
4
 
5
5
  end
data/spec.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Specifications for the CLI Assessment
2
2
 
3
3
  Specs:
4
- - [x] Have a CLI for interfacing with the application
5
- - [x] Pull data from an external source
6
- - [ ] Implement both list and detail views
4
+ - [x] Have a CLI for interfacing with the application : /lib/lesser_evil/command_line_interface.rb
5
+ - [x] Pull data from an external source : Twitter Search API and Vivek Narayanan's sentiment analysis tool
6
+ - [x] Implement both list and detail views : In a manner of speaking. You choose a candidate. Then you choose an intensity of negativity ('angry' or 'very angry'). Then the application finds tweets about your chosen candidate and filters those with the chosen sentiment.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lesser-evil
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Cooper
@@ -119,6 +119,7 @@ extensions: []
119
119
  extra_rdoc_files: []
120
120
  files:
121
121
  - Gemfile
122
+ - LICENSE
122
123
  - README.md
123
124
  - bin/lesser-evil-cli
124
125
  - lib/assets/donald.txt