r_nlp 0.1.2 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 87e56811526a6db4653afc02bc96fa665953cde6
4
- data.tar.gz: 29e9fea5e4a43ba4b49c9678d19093c0737a1ce5
3
+ metadata.gz: 2d8f0021f488416a72a26484fdd9fde599e05244
4
+ data.tar.gz: 185b888000e5cae91aa135987de2a2fa761f4605
5
5
  SHA512:
6
- metadata.gz: f8c971f1ab96d913f9a471a46c55949ef7e36107b577a83602e3ad6b1bbb3c9f6bc57fa07fdf7bcf86046db3e1a3a139a59db1e8983854e6e8e3c198b9117324
7
- data.tar.gz: 5df9a148a7b94f7ea0119de12c039a5024b7f841c80aeee7e2a1bb1487fef2ffc2c58346c1c955acf1e8590e7f6e98c357ecce7dbca85f1a10be25d3a2ea1201
6
+ metadata.gz: 695a3828c1c8e0088e1e34f3e48d086067a228b9c4d239c4465c8913dcd91b2f7447435cd34105faee2e39963f29735ff7a5a8a220c454c56eee69ff0be43ba7
7
+ data.tar.gz: 127b0dba439b80b19be1528f2678f99678f55e22de23e9879720ae89dc209866cc76ea774c06f795a12cf1f6ef61d259add773bec95f1946c20257ef9d163019
data/.gitignore CHANGED
@@ -9,3 +9,4 @@
9
9
  /tmp/
10
10
  .*
11
11
  !.gitignore
12
+ hoge.rb
data/Gemfile CHANGED
@@ -1,4 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in r_nlp.gemspec
4
+ gem 'natto'
4
5
  gemspec
data/lib/r_nlp/tf.rb CHANGED
@@ -12,17 +12,24 @@ module RNlp
12
12
  tf = Hash.new
13
13
  if @lang == 'ja'
14
14
  nm = Natto::MeCab.new
15
- text.each do |line|
16
- nm.parse(title).each do |word|
17
- tf[word.surface] = 1 if tf[word.surface] == nil
18
- tf[word.surface] += 1
15
+ text.split("\n").each do |line|
16
+ nm.parse(line) do |word|
17
+ next if word.stat == 3
18
+ if tf[word.surface] == nil
19
+ tf[word.surface] = 1
20
+ else
21
+ tf[word.surface] += 1
22
+ end
19
23
  end
20
24
  end
21
25
  elsif @lang == 'en'
22
- text.each do |line|
26
+ text.split(" ").each do |line|
23
27
  line.split(" ").each do |word|
24
- tf[word] = 1 if tf[word] == nil
25
- tf[word] += 1
28
+ if tf[word] == nil
29
+ tf[word] = 1
30
+ else
31
+ tf[word] += 1
32
+ end
26
33
  end
27
34
  end
28
35
  else
data/lib/r_nlp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RNlp
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: r_nlp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - himkt