sentimentalizer 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e3157d1123401a03ced17de7c55e6115331490aa
4
+ data.tar.gz: 07869dd69cb3bd464b3d391b35546b70348b6a46
5
+ SHA512:
6
+ metadata.gz: be56e07803500a0714e23061e14fb27f06020671cad0c70622219b75907c90e8c897e52360bda6e3f29964047b4737d95fb5592096ea3abcca0c63a93cf8d132
7
+ data.tar.gz: 458e80553d5b36aa2b068a9dd002c8a7471875e3e5f9284543889b6535f624edcfcb55f0ec1cfd8960e3fc593b9db0f0c44a3acc5624a1dfe953f9ac6fabc810
@@ -0,0 +1 @@
1
+ 2.1.2
@@ -1,17 +1,45 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
+ addressable (2.3.6)
5
+ builder (3.1.4)
4
6
  diff-lcs (1.1.3)
5
- git (1.2.5)
6
- jeweler (1.8.4)
7
+ faraday (0.8.9)
8
+ multipart-post (~> 1.2.0)
9
+ git (1.2.8)
10
+ github_api (0.10.1)
11
+ addressable
12
+ faraday (~> 0.8.1)
13
+ hashie (>= 1.2)
14
+ multi_json (~> 1.4)
15
+ nokogiri (~> 1.5.2)
16
+ oauth2
17
+ hashie (3.3.2)
18
+ highline (1.6.21)
19
+ jeweler (1.8.8)
20
+ builder
7
21
  bundler (~> 1.0)
8
22
  git (>= 1.2.5)
23
+ github_api (= 0.10.1)
24
+ highline (>= 1.6.15)
25
+ nokogiri (= 1.5.10)
9
26
  rake
10
27
  rdoc
11
- json (1.7.5)
12
- multi_json (1.3.7)
13
- rake (0.9.2.2)
14
- rdoc (3.12)
28
+ json (1.8.1)
29
+ jwt (1.2.0)
30
+ multi_json (1.10.1)
31
+ multi_xml (0.5.5)
32
+ multipart-post (1.2.0)
33
+ nokogiri (1.5.10)
34
+ oauth2 (1.0.0)
35
+ faraday (>= 0.8, < 0.10)
36
+ jwt (~> 1.0)
37
+ multi_json (~> 1.3)
38
+ multi_xml (~> 0.5)
39
+ rack (~> 1.2)
40
+ rack (1.5.2)
41
+ rake (10.4.2)
42
+ rdoc (3.12.2)
15
43
  json (~> 1.4)
16
44
  rspec (2.11.0)
17
45
  rspec-core (~> 2.11.0)
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012 malavbhavsar
1
+ Copyright (c) 2015 malavbhavsar
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,24 +1,34 @@
1
1
  # sentimentalizer
2
2
 
3
- This is totally ripped off of from [sentimentalizer](https://github.com/kouphax/sentimentalizer/) which was inspired by [Sentan](https://github.com/martinrue/Sentan).
3
+ Inspired by ~~[Sentan](https://github.com/martinrue/Sentan)~~https://github.com/martinrue/node-sentiment.
4
4
 
5
- This gem is designed to integrate directly with rails.
5
+ This gem can be used separately or integrated with rails app.
6
+
7
+ # Dependency [![Dependency Status](https://gemnasium.com/malavbhavsar/sentimentalizer.png)](https://gemnasium.com/malavbhavsar/sentimentalizer)
8
+
9
+ # Travis [![Build Status](https://secure.travis-ci.org/malavbhavsar/sentimentalizer.png?branch=master)](https://travis-ci.org/malavbhavsar/sentimentalizer)
10
+
11
+ # Codeclimate [![Code Climate](https://codeclimate.com/github/malavbhavsar/sentimentalizer.png)](https://codeclimate.com/github/malavbhavsar/sentimentalizer)
6
12
 
7
13
  ## Instructions for use
8
14
 
9
15
  1. Install gem using bundler `gem "sentimentalizer"`
10
16
 
11
- 2. Run `rails g sentimentalizer`. This will generate an initializer file with after_initialize hook. It's basically training a model to use in the application. It will run everytime you start server or run any rake commands.
17
+ 2. Run `rails g sentimentalizer`. This will generate an initializer file with after_initialize hook for rails. It's basically training a model to use in the application. It will run everytime you start server or run any rake commands, would love some input on this.
12
18
 
13
19
  3. Now, you can run following after ```require "sentimentalizer"```
14
20
  ```ruby
15
21
  Sentimentalizer.analyze('message or tweet or status')
22
+ # or for json output
23
+ Sentimentalizer.analyze('message or tweet or status', true)
16
24
  ```
17
25
 
18
26
  4. You will get output like this
19
27
  ```ruby
20
28
  Sentimentalizer.analyze('i am so happy')
21
29
  => {'text' => 'i am so happy', 'probability' => '0.937', 'sentiment' => ':)' }
30
+ Sentimentalizer.analyze('i am so happy', true)
31
+ => "{\"text\":\"i am so happy\",\"probability\":\"0.937\",\"sentiment\":\":)\"}"
22
32
  ```
23
33
 
24
34
  ## Contributing to sentimentalizer
@@ -33,6 +43,6 @@ Sentimentalizer.analyze('i am so happy')
33
43
 
34
44
  ## Copyright
35
45
 
36
- Copyright (c) 2012 malavbhavsar. See LICENSE.txt for
46
+ Copyright (c) 2015 malavbhavsar. See LICENSE.txt for
37
47
  further details.
38
48
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.2.2
@@ -4,4 +4,4 @@ require 'sentimentalizer'
4
4
  config.after_initialize do
5
5
  Sentimentalizer.setup
6
6
  end
7
- end
7
+ end
@@ -8,11 +8,14 @@ class Sentimentalizer
8
8
  @analyser = Analyser.new
9
9
  @analyser.train_positive "#{File.dirname(__FILE__)}/data/positive"
10
10
  @analyser.train_negative "#{File.dirname(__FILE__)}/data/negative"
11
- puts @analyser.inspect
12
11
  end
13
12
 
14
- def self.analyze(sentence)
15
- @analyser.analyse(sentence).to_json
13
+ def self.analyze(sentence, as_json=nil)
14
+ unless as_json
15
+ @analyser.analyse(sentence)
16
+ else
17
+ @analyser.analyse(sentence).to_json
18
+ end
16
19
  end
17
20
 
18
- end
21
+ end
@@ -2,14 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
+ # stub: sentimentalizer 0.2.2 ruby lib
5
6
 
6
7
  Gem::Specification.new do |s|
7
8
  s.name = "sentimentalizer"
8
- s.version = "0.2.1"
9
+ s.version = "0.2.2"
9
10
 
10
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib"]
11
13
  s.authors = ["malavbhavsar"]
12
- s.date = "2012-11-10"
14
+ s.date = "2014-12-27"
13
15
  s.description = "Sentiment analysis with ruby."
14
16
  s.email = "malav.bhavsar@gmail.com"
15
17
  s.extra_rdoc_files = [
@@ -19,7 +21,7 @@ Gem::Specification.new do |s|
19
21
  s.files = [
20
22
  ".document",
21
23
  ".rspec",
22
- ".rvmrc",
24
+ ".ruby-version",
23
25
  "Gemfile",
24
26
  "Gemfile.lock",
25
27
  "LICENSE.txt",
@@ -832,8 +834,6 @@ Gem::Specification.new do |s|
832
834
  "lib/engine/document.rb",
833
835
  "lib/generators/sentimentalizer_generator.rb",
834
836
  "lib/generators/templates/initializer.rb",
835
- "lib/rails/generators/sentimentalizer/install/install_generator.rb",
836
- "lib/rails/generators/sentimentalizer/install/templates/initializer.rb",
837
837
  "lib/sentimentalizer.rb",
838
838
  "sentimentalizer.gemspec",
839
839
  "spec/sentimentalizer_spec.rb",
@@ -841,12 +841,11 @@ Gem::Specification.new do |s|
841
841
  ]
842
842
  s.homepage = "http://github.com/malavbhavsar/sentimentalizer"
843
843
  s.licenses = ["MIT"]
844
- s.require_paths = ["lib"]
845
- s.rubygems_version = "1.8.24"
844
+ s.rubygems_version = "2.2.2"
846
845
  s.summary = "Sentiment analysis with ruby."
847
846
 
848
847
  if s.respond_to? :specification_version then
849
- s.specification_version = 3
848
+ s.specification_version = 4
850
849
 
851
850
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
852
851
  s.add_development_dependency(%q<rspec>, ["~> 2.11.0"])
@@ -4,10 +4,16 @@ describe "Sentimentalizer" do
4
4
  before do
5
5
  Sentimentalizer.setup
6
6
  end
7
+
7
8
  it "will error without a valid input" do
8
9
  expect{Sentimentalizer.analyze("")}.to raise_error
9
10
  end
10
- it "will return a vlid response with a valid input" do
11
- JSON.parse(Sentimentalizer.analyze("I hate not tests"))["sentiment"].should eq(":(")
11
+
12
+ it "will return a valid ruby hash with a valid input" do
13
+ Sentimentalizer.analyze("I hate not tests").sentiment.should eq(":(")
12
14
  end
13
- end
15
+
16
+ it "will return a valid json string with a valid input" do
17
+ JSON.parse(Sentimentalizer.analyze("I hate not tests", true))["sentiment"].should eq(":(")
18
+ end
19
+ end
metadata CHANGED
@@ -1,78 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sentimentalizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
5
- prerelease:
4
+ version: 0.2.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - malavbhavsar
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-11-10 00:00:00.000000000 Z
11
+ date: 2014-12-27 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rspec
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: 2.11.0
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: 2.11.0
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rdoc
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ~>
31
+ - - "~>"
36
32
  - !ruby/object:Gem::Version
37
33
  version: '3.12'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ~>
38
+ - - "~>"
44
39
  - !ruby/object:Gem::Version
45
40
  version: '3.12'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: jeweler
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ~>
45
+ - - "~>"
52
46
  - !ruby/object:Gem::Version
53
47
  version: 1.8.4
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ~>
52
+ - - "~>"
60
53
  - !ruby/object:Gem::Version
61
54
  version: 1.8.4
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: simplecov
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  description: Sentiment analysis with ruby.
@@ -83,9 +74,9 @@ extra_rdoc_files:
83
74
  - LICENSE.txt
84
75
  - README.md
85
76
  files:
86
- - .document
87
- - .rspec
88
- - .rvmrc
77
+ - ".document"
78
+ - ".rspec"
79
+ - ".ruby-version"
89
80
  - Gemfile
90
81
  - Gemfile.lock
91
82
  - LICENSE.txt
@@ -898,8 +889,6 @@ files:
898
889
  - lib/engine/document.rb
899
890
  - lib/generators/sentimentalizer_generator.rb
900
891
  - lib/generators/templates/initializer.rb
901
- - lib/rails/generators/sentimentalizer/install/install_generator.rb
902
- - lib/rails/generators/sentimentalizer/install/templates/initializer.rb
903
892
  - lib/sentimentalizer.rb
904
893
  - sentimentalizer.gemspec
905
894
  - spec/sentimentalizer_spec.rb
@@ -907,29 +896,25 @@ files:
907
896
  homepage: http://github.com/malavbhavsar/sentimentalizer
908
897
  licenses:
909
898
  - MIT
899
+ metadata: {}
910
900
  post_install_message:
911
901
  rdoc_options: []
912
902
  require_paths:
913
903
  - lib
914
904
  required_ruby_version: !ruby/object:Gem::Requirement
915
- none: false
916
905
  requirements:
917
- - - ! '>='
906
+ - - ">="
918
907
  - !ruby/object:Gem::Version
919
908
  version: '0'
920
- segments:
921
- - 0
922
- hash: -316156621
923
909
  required_rubygems_version: !ruby/object:Gem::Requirement
924
- none: false
925
910
  requirements:
926
- - - ! '>='
911
+ - - ">="
927
912
  - !ruby/object:Gem::Version
928
913
  version: '0'
929
914
  requirements: []
930
915
  rubyforge_project:
931
- rubygems_version: 1.8.24
916
+ rubygems_version: 2.2.2
932
917
  signing_key:
933
- specification_version: 3
918
+ specification_version: 4
934
919
  summary: Sentiment analysis with ruby.
935
920
  test_files: []
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm --create 1.9.3-dev@sentimentalizer
@@ -1,8 +0,0 @@
1
-
2
- class InstallGenerator < Rails::Generators::Base
3
- source_root File.expand_path("../templates", __FILE__)
4
- # all public methods in here will be run in order
5
- def add_my_initializer
6
- template "initializer.rb", "config/initializers/sentimentalizer_initializer.rb"
7
- end
8
- end
@@ -1,7 +0,0 @@
1
- require 'sentimentalizer'
2
-
3
- Rails.application.configure do
4
- config.after_initialize do
5
- Sentimentalizer.setup
6
- end
7
- end