shiner 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/lib/shiner/version.rb +1 -1
  2. data/lib/shiner.rb +2 -2
  3. metadata +3 -3
@@ -1,3 +1,3 @@
1
1
  module Shiner
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/shiner.rb CHANGED
@@ -20,7 +20,7 @@ module Shiner
20
20
  sentences.each_index{|index|
21
21
  batch={:sentences => sentences[index, options[:max_sentences]]}
22
22
  batch[:sentences].pop while options[:max_length] && batch[:sentences].collect{|sentence| sentence[:sentence]}.join(' ').length > options[:max_length]
23
- batch[:score] = batch[:sentences].collect{|sentence| sentence[:score]}.sum
23
+ batch[:score] = batch[:sentences].collect{|sentence| sentence[:score]}.sum.to_f / batch[:sentences].size
24
24
  batches << batch
25
25
  }
26
26
  best = batches.sort_by{|batch| batch[:score]}.last
@@ -31,7 +31,7 @@ module Shiner
31
31
  string_to_sentences(string).each{ |sentence|
32
32
  classifications = classifier.classifications(sentence)
33
33
  sentences << {:sentence => sentence, :classifications => classifications,
34
- :score => (classifications['Interesting'] - classifications['Uninteresting']) / (-classifications['Uninteresting']) }
34
+ :score => 1 - classifications['Interesting'] / classifications['Uninteresting'] }
35
35
  }
36
36
  #sentences = sentences.sort_by{|sentence| sentence[:score] }
37
37
  sentences
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shiner
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jason Ling Xiaowei