ostrica 0.1.0

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 ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YTJkYjM3Y2QzZTc0MzdhNjcwNGIxMDA1MWMxMzhlNDc2YWVhOGIwNQ==
5
+ data.tar.gz: !binary |-
6
+ YjIxMWJmMTc1ZTQwYzcxZWE0MzdjNDRkMzkyMjNhYWM4N2ViYjVhOQ==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ NzE0ZWE2ZDE1Y2EzMjNhY2RmMzIzZWZhMDgxM2E3YjMwYzk1OGRjZTJjZjM2
10
+ MmIwYmRiM2M5ZTBmZTc0MTNhYWVhZWM5ZTY4YmY5ZGI4YzA0YmQ4NjU5NzUz
11
+ OTZhZjExMmFiNWQwYTlmZjlmYjg5ODUzMmZjOWE5NGMxYjQyYTA=
12
+ data.tar.gz: !binary |-
13
+ M2VkZGYzYzUzYjY3YmZjNTNjZGU1OGFlZTlhMzQxNWJhNzNhZjI2YzllOGQy
14
+ ODdjNzFhYmQ5M2FjYTYxOTMzMWEyZGExMjVkM2Q2NTMxYWVmMjcwODcwZGYw
15
+ YTNjMmFiMjk1ODA3ZDQwOTQ4MGU1MjNkNDk2M2VkZDkwYjNjMjk=
@@ -0,0 +1,11 @@
1
+ module Ostrica
2
+ class Classify
3
+ def initialize(pearl)
4
+ @pearl = pearl
5
+ end
6
+
7
+ def call(data)
8
+ @pearl.system.classify(data)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,8 @@
1
+ module Ostrica
2
+ module Error
3
+ module Configuration
4
+ class DataNameMissing < StandardError
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,25 @@
1
+ require 'ostrica/train'
2
+ require 'ostrica/classify'
3
+
4
+ module Ostrica
5
+ class Factory
6
+
7
+ def initialize(configured_ostrica_module)
8
+ @ostrica = configured_ostrica_module
9
+ end
10
+
11
+ def set_pearl(category1, category2)
12
+ @pearl ||= @ostrica.persister.new(@ostrica.data_name) {
13
+ @ostrica.classifier.new(category1, category2)
14
+ }
15
+ end
16
+
17
+ def train
18
+ Ostrica::Train.new(@pearl)
19
+ end
20
+
21
+ def classify
22
+ Ostrica::Classify.new(@pearl)
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,14 @@
1
+ module Ostrica
2
+ class Train
3
+ def initialize(pearl)
4
+ @pearl = pearl
5
+ end
6
+
7
+ def call(training_category, data)
8
+ training_method = "train_#{training_category}".to_sym
9
+
10
+ @pearl.system.send(training_method, data)
11
+ @pearl.take_snapshot
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,3 @@
1
+ module Ostrica
2
+ VERSION = '0.1.0'
3
+ end
data/lib/ostrica.rb ADDED
@@ -0,0 +1,22 @@
1
+ require 'classifier'
2
+ require 'madeleine'
3
+ require 'ostrica/factory'
4
+ require 'ostrica/error/configuration/data_name_missing'
5
+
6
+ module Ostrica
7
+ class << self
8
+ attr_accessor :persister, :classifier, :data_name
9
+ end
10
+
11
+ def self.configure(opts)
12
+ raise Ostrica::Error::Configuration::DataNameMissing if opts[:data_name].nil?
13
+
14
+ @persister = SnapshotMadeleine
15
+ @classifier = Classifier::Bayes
16
+ @data_name = opts[:data_name]
17
+ end
18
+
19
+ def self.factory(configured_ostrica_module)
20
+ Ostrica::Factory.new(configured_ostrica_module)
21
+ end
22
+ end
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ostrica
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Kelsey Mok
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-08-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: classifier
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: madeleine
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '10.1'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '10.1'
55
+ description: Bayesian filtration
56
+ email:
57
+ - kelseymok@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - lib/ostrica/classify.rb
63
+ - lib/ostrica/error/configuration/data_name_missing.rb
64
+ - lib/ostrica/factory.rb
65
+ - lib/ostrica/train.rb
66
+ - lib/ostrica/version.rb
67
+ - lib/ostrica.rb
68
+ homepage: ''
69
+ licenses: []
70
+ metadata: {}
71
+ post_install_message:
72
+ rdoc_options: []
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ! '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ! '>='
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ requirements: []
86
+ rubyforge_project:
87
+ rubygems_version: 2.0.3
88
+ signing_key:
89
+ specification_version: 4
90
+ summary: Bayesian filtration
91
+ test_files: []