natto2classifier 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 467084b3f6d6753e7726ad63c605327a8e3f9101
4
- data.tar.gz: 5a1e0626b40e9cc609e5538d1abc908b7703e6bf
3
+ metadata.gz: 02b109066fdf91265548ae0c5d134540b133abf6
4
+ data.tar.gz: 897e64f5e80a5a9bf6148cfd63aec5d4088f31f4
5
5
  SHA512:
6
- metadata.gz: cbfa8401893901358bdf76fa11b61c4fb83b1082d9c87af130eee494826ff45933e59dd0fc010f6de3ebfdb03ee4370c470832a1a96deaf51650fafd13edc4da
7
- data.tar.gz: e73d5810a86572337237f799beee740fd0aba4f864a04bc44ed091b585df4b829a7a37475d0720084d415c2117e5c6e46359bfc62a524b19b69466d84ed7cabd
6
+ metadata.gz: 1d04874ddf991c810524e1dd8d496037416ad14b85032e9ad4fbc0ec82fd6331e4d223e92c2b2f32d7942e3ec9f2b5c05bbdae2cb33d2e442993a379621e7560
7
+ data.tar.gz: 35dfad66177cbce511c1b301a43e6f8683cda0a366ad1ce9ab609e080f4d4becac8772a9192dd9b07a6b75bb5edd20432a9e27ef83b650d5e054f5dc38bc94ca
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- natto2classifier (0.1.0)
4
+ natto2classifier (0.1.2)
5
5
  classifier-reborn
6
6
  natto
7
7
 
@@ -4,11 +4,11 @@ require 'natto'
4
4
  module Natto2classifier
5
5
  class Natto
6
6
  def self.parse(word)
7
- raise 'input word is not exist.' unless word.is_a?(String)
8
-
9
- nm = ::Natto::MeCab.new('-F%m')
7
+ nm = ::Natto::MeCab.new('-F%m\s%f[7]')
10
8
  results = []
11
- nm.enum_parse(word).each{|n| results << n.feature if !n.is_eos? }
9
+ nm.enum_parse(word.to_s).each do |n|
10
+ results << n.feature if !n.is_eos?
11
+ end
12
12
  results
13
13
  end
14
14
  end
@@ -1,3 +1,3 @@
1
1
  module Natto2classifier
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -4,19 +4,13 @@ require 'classifier-reborn'
4
4
 
5
5
  module Natto2classifier
6
6
  # It is a library that classifies Japanese language.
7
- class Bayes
8
- def initialize(*category)
9
- raise 'category is not exists' if category.nil?
10
- raise 'category is not array' unless category.is_a?(Array)
11
- @bayes = ClassifierReborn::Bayes.new(*category)
12
- end
13
-
7
+ class Bayes < ClassifierReborn::Bayes
14
8
  def train(category, word)
15
- @bayes.train category, Natto2classifier::Natto.parse(word).join(' ')
9
+ super category, Natto2classifier::Natto.parse(word).join(' ')
16
10
  end
17
11
 
18
12
  def classify(word)
19
- @bayes.classify word
13
+ super Natto2classifier::Natto.parse(word).join(' ')
20
14
  end
21
15
  end
22
16
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: natto2classifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - kanayannet
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-04-23 00:00:00.000000000 Z
11
+ date: 2018-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler