shiner 0.0.4 → 0.0.5
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 +1 -0
- metadata +3 -3
data/lib/shiner/version.rb
CHANGED
data/lib/shiner.rb
CHANGED
@@ -21,6 +21,7 @@ module Shiner
|
|
21
21
|
next if options[:max_length] && batch[:sentences].collect{|sentence| sentence[:sentence]}.join(' ').length < options[:max_length] && batches.size > 0 #don't take last few sentences if they do not meet max_length
|
22
22
|
next if options[:max_sentences] && batch[:sentences].size < options[:max_sentences] && batches.size > 0 #don't take last few sentences if they do not meet max_sentences
|
23
23
|
batch[:sentences].pop while options[:max_length] && batch[:sentences].collect{|sentence| sentence[:sentence]}.join(' ').length > options[:max_length]
|
24
|
+
next if batch[:sentences].empty?
|
24
25
|
batch[:score] = batch[:sentences].collect{|sentence| sentence[:score]}.sum.to_f / batch[:sentences].size
|
25
26
|
batches << batch
|
26
27
|
}
|
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: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jason Ling Xiaowei
|