natto2classifier 0.1.3 → 0.2.0

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: f933e506e593fedf2eeb3c43e73c3de5fe39d84b
4
- data.tar.gz: 6406772efd4fdba35779207d791d0a9c6e257092
3
+ metadata.gz: 51ad6e9876016e7a4202e0c5e97e2c1e67d208c4
4
+ data.tar.gz: 9684166a82e326f30b5b21a63658cd708540baad
5
5
  SHA512:
6
- metadata.gz: cecd63071da50fbc05b970aa730fcdeb1cb65fbd7a34ddd1e0834f1d845cd7c7fe0216626c504406878c6b9391d44f2be748c5864482babdc000a05d8f9f74a6
7
- data.tar.gz: 9b12fd6dde86b47fb731f41112b7990cd74dc641ecffaf096c976b4b6dd967f60e433d1a0c53c70e68c1b114b991ffdceee0ccf32b1b325d5fdbeeb1b3e77eec
6
+ metadata.gz: b2811c6898c36d2e5d37267023a2f6121e38fa953e3c3d7191225b8d704c0c1d83c651f20353a09530739c46a8d0239f1d638153ffc221cd21509f6785323e44
7
+ data.tar.gz: a9e57167f00b04feac3653cbe2a8362ac0cfc0946dad2e34912764173a03ca35c8db77404feb285cde009e8380a26033b8e501ab53b9a6e873d7cfc63be52e77
@@ -0,0 +1,24 @@
1
+ version: 2
2
+ jobs:
3
+ test:
4
+ docker:
5
+ - image: kanayannet/natto2classifier:latest
6
+ steps:
7
+ - checkout
8
+ - run: bundle install
9
+ - run: bundle exec ruby test/natto2classifier_test.rb
10
+ workflows:
11
+ version: 2
12
+ test:
13
+ jobs:
14
+ - test
15
+ scheduled-workflow:
16
+ triggers:
17
+ - schedule:
18
+ cron: "0 * * * *"
19
+ filters:
20
+ branches:
21
+ only:
22
+ - master
23
+ jobs:
24
+ - test
data/Gemfile.lock CHANGED
@@ -1,9 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- natto2classifier (0.1.3)
4
+ natto2classifier (0.2.0)
5
5
  classifier-reborn
6
6
  natto
7
+ rb-gsl
7
8
 
8
9
  GEM
9
10
  remote: https://rubygems.org/
@@ -13,6 +14,7 @@ GEM
13
14
  coderay (1.1.2)
14
15
  fast-stemmer (1.0.2)
15
16
  ffi (1.9.23)
17
+ gsl (2.1.0.3)
16
18
  method_source (0.9.0)
17
19
  minitest (5.11.3)
18
20
  natto (1.1.1)
@@ -21,6 +23,8 @@ GEM
21
23
  coderay (~> 1.1.0)
22
24
  method_source (~> 0.9.0)
23
25
  rake (10.5.0)
26
+ rb-gsl (1.16.0.6)
27
+ gsl
24
28
 
25
29
  PLATFORMS
26
30
  ruby
data/README.md CHANGED
@@ -12,7 +12,7 @@ gem 'natto2classifier'
12
12
 
13
13
  And then execute:
14
14
 
15
- $ bundle
15
+ $ bundle install
16
16
 
17
17
  Or install it yourself as:
18
18
 
@@ -20,11 +20,23 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
+ ### Baysian methods
24
+
25
+ ```
26
+ bayes = Natto2classifier::Bayes.new '朝食', '夕食'
27
+ bayes.train '朝食', '今日の朝食は納豆だ'
28
+ bayes.train '夕食', '今日の夕食は湯豆腐だ'
29
+ bayes.classify '納豆はいつも朝食べている' #=> '朝食'
30
+ ```
31
+
32
+ ### LSI methods
33
+
23
34
  ```
24
- classifier = Natto2classifier::Bayes.new '朝食', '夕食'
25
- classifier.train '朝食', '今日の朝食は納豆だ'
26
- classifier.train '夕食', '今日の夕食は湯豆腐だ'
27
- classifier.classify '納豆はいつも朝食べている' #=> '朝食'
35
+ lsi = Natto2classifier::LSI.new
36
+ lsi.add_item '今日の朝食は納豆だ', '朝食'
37
+ lsi.add_item '今日の夕食は湯豆腐だ', '夕食'
38
+ lsi.classify '納豆はいつも朝食べている' #=> '朝食'
39
+ lsi.find_related '納豆はいつも朝食べている' #=> ['今日 キョウ の ノ 朝食 チョウショク は ハ 納豆 ナットウ だ ダ', '今日 キョウ の ノ 夕食 ユウショク は ハ 湯豆腐 ユドウフ だ ダ']
28
40
  ```
29
41
 
30
42
  ## Development
data/data/train.csv CHANGED
@@ -1,5 +1,5 @@
1
1
  朝食,卵かけご飯は醤油とあう
2
- 朝食,目玉焼きは塩故障派だ。
2
+ 朝食,目玉焼きは塩胡椒派だ。
3
3
  朝食,納豆かけご飯はとても健康によい
4
4
  朝食,食パンはオーソドックスな朝食だ
5
5
  朝食,スクランブルエッグはホテルの朝食でよく出る
@@ -1,20 +1,5 @@
1
1
  require 'natto2classifier/version'
2
2
  require 'natto2classifier/natto'
3
3
  require 'classifier-reborn'
4
-
5
- module Natto2classifier
6
- # It is a library that classifies Japanese language.
7
- class Bayes < ClassifierReborn::Bayes
8
- alias_method :__train__, :train
9
- alias_method :__classify__, :classify
10
- private :__train__, :__classify__
11
-
12
- def train(category, word)
13
- __train__ category, Natto2classifier::Natto.parse(word).join(' ')
14
- end
15
-
16
- def classify(word)
17
- __classify__ Natto2classifier::Natto.parse(word).join(' ')
18
- end
19
- end
20
- end
4
+ require 'natto2classifier/bayes'
5
+ require 'natto2classifier/lsi'
@@ -1,3 +1,3 @@
1
1
  module Natto2classifier
2
- VERSION = "0.1.3"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -27,4 +27,5 @@ Gem::Specification.new do |spec|
27
27
  spec.add_development_dependency "pry"
28
28
  spec.add_runtime_dependency "natto"
29
29
  spec.add_runtime_dependency "classifier-reborn"
30
+ spec.add_runtime_dependency "rb-gsl"
30
31
  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.3
4
+ version: 0.2.0
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-26 00:00:00.000000000 Z
11
+ date: 2018-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rb-gsl
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
97
111
  description: It is a library that classifies Japanese language. It depends on classifier-reborn
98
112
  and natto.
99
113
  email:
@@ -102,6 +116,7 @@ executables: []
102
116
  extensions: []
103
117
  extra_rdoc_files: []
104
118
  files:
119
+ - ".circleci/config.yml"
105
120
  - ".gitignore"
106
121
  - ".travis.yml"
107
122
  - CODE_OF_CONDUCT.md