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.
- data/lib/shiner/version.rb +1 -1
- data/lib/shiner.rb +2 -2
- metadata +3 -3
data/lib/shiner/version.rb
CHANGED
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 =>
|
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:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jason Ling Xiaowei
|