bm25 0.1.3 → 0.1.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1a99f7e2ba2f3c27e3683119915f8d0f8bfe2d876ac872d1b9798727f31deefa
4
- data.tar.gz: c5c3f13b6d5cd86baa620d16f0594ff4257562d259432c1b3695b9c3ba72f4d7
3
+ metadata.gz: 3cb66896c835cefd13368e83f874fb6a0d3667bade74c27e3f069685fade9abc
4
+ data.tar.gz: 40b158e69b60560e880fc40ffab05b01066fe3e49ade003b1bda51bb920fd09e
5
5
  SHA512:
6
- metadata.gz: 74aecf440fe5ad44c6e01d4f59b6dd2c082558a466431928c91d9051a2c63d7eb14eb9c5b7bc88be502b38c1dc344a970e1dd329354956e29d0e6f3598b8521f
7
- data.tar.gz: e7e10625e4ff8d6f1d237712a8c5381b75f1c8a9fb70fc475b55d17783263455722d5b438080681c7dbf317b4960e6bd89e8e8fe88922b57455ae24ffd91abb6
6
+ metadata.gz: 301214a74bb46d76161264e1f767dd34d09216734b17cb55ad955eda0e741a648dc259778b24eb9bcfa51b8659a60a7bf310044992e626ceaa3e5187fa405bd9
7
+ data.tar.gz: 3b6b7938854cd8eba7581599f107f17f7fc7234923c36c96fc07f1fb800f178bdbbce08710692481ef561859475bbd59b8eddc59a1a5135aa6667f47b4ce9302
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bm25 (0.1.3)
4
+ bm25 (0.1.4)
5
5
  natto
6
6
 
7
7
  GEM
data/lib/bm25/parser.rb CHANGED
@@ -20,6 +20,9 @@ module Bm25
20
20
  end
21
21
 
22
22
  def execute(document)
23
+ if document.length < 1
24
+ raise '文字を渡してください'
25
+ end
23
26
  @allword_length = 0
24
27
  @idf_map = {}
25
28
  @docs = []
@@ -100,16 +100,13 @@
100
100
  よそ
101
101
  わけ
102
102
  わたし
103
-
103
+ けど
104
+ ので
104
105
  ハイ
105
-
106
-
107
106
 
108
107
 
109
108
 
110
109
 
111
-
112
-
113
110
 
114
111
 
115
112
 
@@ -131,8 +128,6 @@
131
128
 
132
129
 
133
130
 
134
-
135
-
136
131
 
137
132
 
138
133
 
@@ -230,10 +225,6 @@
230
225
 
231
226
 
232
227
  簿
233
-
234
-
235
-
236
-
237
228
 
238
229
 
239
230
 
@@ -246,21 +237,16 @@
246
237
 
247
238
 
248
239
 
249
-
250
240
 
251
241
 
252
242
 
253
243
 
254
244
 
255
245
 
256
-
257
246
 
258
247
 
259
248
 
260
249
 
261
-
262
-
263
-
264
250
 
265
251
 
266
252
 
@@ -276,8 +262,6 @@
276
262
 
277
263
 
278
264
 
279
-
280
-
281
265
  下記
282
266
  上記
283
267
  時間
data/lib/bm25/utils.rb CHANGED
@@ -6,8 +6,8 @@ module Bm25
6
6
 
7
7
  def is_stopword? (word)
8
8
  match = false
9
-
10
- File.open("lib/bm25/stopword.txt", "r") do |f|
9
+ stopword_path = File.join( File.dirname(__FILE__), 'stopword.txt' )
10
+ File.open(stopword_path, "r") do |f|
11
11
  f.each_line do |t|
12
12
  if t.chomp === word
13
13
  match = true
data/lib/bm25/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Bm25
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bm25
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masayuki Komatsu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-26 00:00:00.000000000 Z
11
+ date: 2018-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler