baby_face 0.0.1 → 0.0.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: d3c03bdf7d6799c174a0c9c535c6fab41f18bccb
4
- data.tar.gz: a6919788bac4954f5c982c2ca359e492c5bdfae9
3
+ metadata.gz: d6ae82fe6eada63285a9f8aaf510b33681bd5360
4
+ data.tar.gz: c3fca97bce0f6d41e8bfaaab38216a3e22510c62
5
5
  SHA512:
6
- metadata.gz: 20a084a3ff38c57b8d480a396a11592285287b632c61172f444bb74a4247bf763865c15a916bdf466d3dcd08d093a415ed7460d00d55d7e7caf0e915fd5de036
7
- data.tar.gz: 2c4955b4aff1056b0022a21f3838f771aa20f698b34007b7d78024873ca89ee5a483a0788e90d1f428e4ebd6aa3d57734e66fdf498afe8efe1d1ec50b8bde788
6
+ metadata.gz: 075e470aaa02cea2e7824af68828568a38d49ba5fe030b80564942af821404047536aece1fd7f6014aa7321f6518df3b6ad7ecff3d2f60adc96153c1d902b546
7
+ data.tar.gz: 6178769b307411ee5a001c5a20a7a14798f264e6f125a583b36c6e4fd844be3602a24c88c82ef02791e76f7cbe982a24b843323183d7668ea789864530fc55d6
data/README.md CHANGED
@@ -24,8 +24,8 @@ Or install it yourself as:
24
24
  ```ruby
25
25
  class Jedi
26
26
  include BabyFace
27
- acts_as_babyface features: :name,
28
- categories: [:light_side, :dark_side]
27
+ baby_face_for features: :name,
28
+ categories: [:light_side, :dark_side]
29
29
 
30
30
  attr_accessor :name
31
31
  def initialize(name)
@@ -37,22 +37,22 @@ end
37
37
  ### training
38
38
 
39
39
  ```ruby
40
- Jedi.new("Anakin Skywalker").babyface.train_light_side
41
- Jedi.new("Darth Maul").babyface.train_dark_side
40
+ Jedi.new("Anakin Skywalker").baby_face.train_light_side
41
+ Jedi.new("Darth Maul").baby_face.train_dark_side
42
42
  ```
43
43
 
44
44
  ### classify
45
45
 
46
46
  ```ruby
47
- Jedi.new("Luke Skywalker").babyface.light_side? # => true
48
- Jedi.new("Darth Vader").babyface.dark_side? # => true
47
+ Jedi.new("Luke Skywalker").baby_face.light_side? # => true
48
+ Jedi.new("Darth Vader").baby_face.dark_side? # => true
49
49
  ```
50
50
 
51
51
  ### save training data
52
52
 
53
53
  ```ruby
54
54
  BabyFace.configuration.data_dir = "/tmp/baby_face"
55
- Jedi.new("Luke Skywalker").babyface.save # => /tmp/baby_face/jedi.babyface
55
+ Jedi.new("Luke Skywalker").baby_face.save # => /tmp/baby_face/jedi.babyface
56
56
  ```
57
57
 
58
58
 
@@ -61,9 +61,9 @@ Jedi.new("Luke Skywalker").babyface.save # => /tmp/baby_face/jedi.babyface
61
61
  default : String#split
62
62
 
63
63
  ```ruby
64
- acts_as_babyface features: :name,
65
- categories: [:ham, :spam],
66
- tokenizer: ->(text) {[text.upcase]}
64
+ baby_face_for features: :name,
65
+ categories: [:ham, :spam],
66
+ tokenizer: ->(text) {[text.upcase]}
67
67
 
68
68
  ```
69
69
 
@@ -74,13 +74,13 @@ support nested BabyFace object, array and hash.
74
74
  class Entry < ActiveRecord::Base
75
75
  has_many :comments
76
76
  include BabyFace
77
- acts_as_babyface features: :title, :body, :comments,
78
- categories: [:ham, :spam]
77
+ baby_face_for features: :title, :body, :comments,
78
+ categories: [:ham, :spam]
79
79
  end
80
80
 
81
81
  class Comment < ActiveRecord::Base
82
82
  include BabyFace
83
- acts_as_babyface features: :title, :message
83
+ baby_face_for features: :title, :message
84
84
  end
85
85
  ```
86
86
 
@@ -1,3 +1,3 @@
1
1
  module BabyFace
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/baby_face.rb CHANGED
@@ -10,7 +10,7 @@ module BabyFace
10
10
 
11
11
  def BabyFace.included(mod)
12
12
  mod.define_singleton_method(
13
- :acts_as_babyface,
13
+ :baby_face_for,
14
14
  lambda { |config|
15
15
  features = *config[:features]
16
16
  categories = *config[:categories]
@@ -21,7 +21,7 @@ module BabyFace
21
21
  )
22
22
  end
23
23
 
24
- def babyface
25
- @_babyface ||= BabyFace::Stand.new(self)
24
+ def baby_face
25
+ @_baby_face ||= BabyFace::Stand.new(self)
26
26
  end
27
27
  end
@@ -3,12 +3,12 @@ require "baby_face"
3
3
  describe BabyFace::Stand do
4
4
 
5
5
  describe "#to_feature" do
6
- subject { target.babyface.to_feature }
6
+ subject { target.baby_face.to_feature }
7
7
 
8
8
  class Hoge
9
9
  include BabyFace
10
10
  attr_accessor :title, :name
11
- acts_as_babyface features: [:title, :name]
11
+ baby_face_for features: [:title, :name]
12
12
 
13
13
  def initialize(title: "Revenge of the Sith", name: "Anakin Skywalker")
14
14
  @title = title
@@ -19,7 +19,7 @@ describe BabyFace::Stand do
19
19
  class Bar
20
20
  include BabyFace
21
21
  attr_accessor :attr1, :attr2
22
- acts_as_babyface features: [:attr1, :attr2]
22
+ baby_face_for features: [:attr1, :attr2]
23
23
 
24
24
  def initialize(attr1: "foo", attr2: "bar")
25
25
  @attr1 = attr1
@@ -57,24 +57,24 @@ describe BabyFace::Stand do
57
57
  class Dummy
58
58
  include BabyFace
59
59
  attr_accessor :name
60
- acts_as_babyface features: :name
60
+ baby_face_for features: :name
61
61
  end
62
- let(:babyface) { Dummy.new.babyface }
62
+ let(:baby_face) { Dummy.new.baby_face }
63
63
 
64
- it { expect(babyface.wakachi("aaa bbb")).to eq ["aaa", "bbb"] }
64
+ it { expect(baby_face.wakachi("aaa bbb")).to eq ["aaa", "bbb"] }
65
65
  end
66
66
 
67
67
  context "Use tokenizer" do
68
68
  class Dummy2
69
69
  include BabyFace
70
70
  attr_accessor :name
71
- acts_as_babyface features: :name,
71
+ baby_face_for features: :name,
72
72
  tokenizer: ->(text) {[text.upcase]}
73
73
 
74
74
  end
75
- let(:babyface) { Dummy2.new.babyface }
75
+ let(:baby_face) { Dummy2.new.baby_face }
76
76
 
77
- it { expect(babyface.wakachi("aaa bbb")).to eq ["AAA BBB"] }
77
+ it { expect(baby_face.wakachi("aaa bbb")).to eq ["AAA BBB"] }
78
78
  end
79
79
  end
80
80
 
@@ -82,7 +82,7 @@ describe BabyFace::Stand do
82
82
  class Jedi
83
83
  include BabyFace
84
84
  attr_accessor :name
85
- acts_as_babyface features: :name,
85
+ baby_face_for features: :name,
86
86
  categories: [:light_side, :dark_side]
87
87
 
88
88
  def initialize(name)
@@ -92,18 +92,18 @@ describe BabyFace::Stand do
92
92
 
93
93
  it 'train jedi' do
94
94
  10.times {
95
- Jedi.new("Anakin Skywalker").babyface.train_light_side
95
+ Jedi.new("Anakin Skywalker").baby_face.train_light_side
96
96
  }
97
97
 
98
98
  10.times {
99
- Jedi.new("Darth Maul").babyface.train_dark_side
99
+ Jedi.new("Darth Maul").baby_face.train_dark_side
100
100
  }
101
101
 
102
102
  luke = Jedi.new("Luke Skywalker")
103
103
  vader = Jedi.new("Darth Vader")
104
104
 
105
- expect(luke.babyface).to be_light_side
106
- expect(vader.babyface).to be_dark_side
105
+ expect(luke.baby_face).to be_light_side
106
+ expect(vader.baby_face).to be_dark_side
107
107
  end
108
108
  end
109
109
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: baby_face
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoshiori SHOJI
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-03 00:00:00.000000000 Z
11
+ date: 2013-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: classifier