textmood 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +8 -4
  2. data/lib/textmood.rb +6 -2
  3. metadata +1 -1
data/README.md CHANGED
@@ -51,7 +51,7 @@ You can use it in a Ruby program like this:
51
51
  ```ruby
52
52
  require "textmood"
53
53
 
54
- # The :lang parameter makes TextMood use one of the bundled language sentiment files
54
+ # The :language parameter makes TextMood use one of the bundled language sentiment files
55
55
  tm = TextMood.new(language: "en")
56
56
  score = tm.analyze("some text")
57
57
  #=> '1.121'
@@ -133,10 +133,10 @@ output from `textmood -h`:
133
133
  ```
134
134
  Usage: textmood [options] "<text>"
135
135
  OR
136
- echo "<text>" | textmood [options]
136
+ echo "<text>" | textmood [options]"
137
137
 
138
- Returns a floating-point sentiment score of the provided text.
139
- Above 0 is considered positive, below is considered negative.
138
+ Returns a sentiment score of the provided text. Above 0 is usually
139
+ considered positive, below is considered negative.
140
140
 
141
141
  MANDATORY options:
142
142
  -l, --language LANGUAGE The IETF language tag for the provided text.
@@ -181,6 +181,10 @@ OPTIONAL options:
181
181
  -k, --skip-symbols Do not include symbols file (emoticons etc.). Only applies
182
182
  when using -l/--language.
183
183
 
184
+ -c, --config PATH TO FILE Use the specified config file. If not specified, textmood will look
185
+ for /etc/textmood.cfg and ~/.textmood. Settings in the user config
186
+ will override settings from the global file.
187
+
184
188
  -d, --debug Prints out the score for each token in the provided text
185
189
  or 'nil' if the token was not found in the sentiment file
186
190
 
data/lib/textmood.rb CHANGED
@@ -138,8 +138,12 @@ class TextMood
138
138
  end
139
139
 
140
140
  def normalize_score(score, count)
141
- factor = NORMALIZE_TO.to_f / count.to_f
142
- (score * factor).round
141
+ if score != 0
142
+ factor = NORMALIZE_TO.to_f / count.to_f
143
+ (score * factor).round
144
+ else
145
+ score
146
+ end
143
147
  end
144
148
 
145
149
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: textmood
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: