omnicat 0.2.0 → 0.2.1
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.
- data/CHANGELOG.txt +2 -0
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/lib/omnicat.rb +0 -1
- data/lib/omnicat/base.rb +4 -12
- data/lib/omnicat/classifiers/strategy.rb +1 -1
- data/lib/omnicat/version.rb +1 -1
- data/omnicat.gemspec +9 -8
- data/{lib/test → test}/test_helper.rb +1 -1
- data/{lib/test → test}/unit/array_test.rb +0 -0
- data/{lib/test → test}/unit/classifier_test.rb +0 -0
- data/{lib/test → test}/unit/classifiers/strategy_test.rb +0 -0
- data/{lib/test → test}/unit/doc_test.rb +0 -0
- metadata +29 -10
- data/lib/omnicat/hash.rb +0 -13
- data/lib/test/unit/hash_test.rb +0 -12
data/CHANGELOG.txt
CHANGED
data/README.md
CHANGED
@@ -35,7 +35,7 @@ OmniCat allows you to change strategy on runtime.
|
|
35
35
|
classifier.classify('I am happy :)')
|
36
36
|
...
|
37
37
|
# change strategy to Support Vector Machine (SVM) on runtime
|
38
|
-
classifier = OmniCat::
|
38
|
+
classifier.strategy = OmniCat::Classifiers::SVM.new
|
39
39
|
# now you do not need to re-train, add category and so on..
|
40
40
|
# just classify with new strategy
|
41
41
|
classifier.classify('I am happy :)')
|
data/Rakefile
CHANGED
data/lib/omnicat.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/omnicat/version'
|
2
2
|
require File.dirname(__FILE__) + '/omnicat/configuration'
|
3
3
|
require File.dirname(__FILE__) + '/omnicat/array'
|
4
|
-
require File.dirname(__FILE__) + '/omnicat/hash'
|
5
4
|
require File.dirname(__FILE__) + '/omnicat/base'
|
6
5
|
require File.dirname(__FILE__) + '/omnicat/doc'
|
7
6
|
require File.dirname(__FILE__) + '/omnicat/result'
|
data/lib/omnicat/base.rb
CHANGED
@@ -1,16 +1,8 @@
|
|
1
|
+
require 'hashable'
|
2
|
+
|
1
3
|
module OmniCat
|
2
4
|
class Base
|
3
|
-
|
4
|
-
|
5
|
-
# @return Base object instance variables in a Hash
|
6
|
-
def to_hash
|
7
|
-
hash = {}
|
8
|
-
self.instance_variables.each do |key|
|
9
|
-
if val = instance_variable_get(key)
|
10
|
-
hash[key[1..-1].to_sym] = val.class.to_s.include?('OmniCat') ? val.to_hash : val
|
11
|
-
end
|
12
|
-
end
|
13
|
-
hash
|
14
|
-
end
|
5
|
+
include Hashable
|
6
|
+
def to_hash; self.to_dh; end
|
15
7
|
end
|
16
8
|
end
|
@@ -17,7 +17,7 @@ module OmniCat
|
|
17
17
|
attr_accessor :uniq_token_count # Integer - Total uniq token count
|
18
18
|
|
19
19
|
def initialize(strategy_hash = {})
|
20
|
-
@categories =
|
20
|
+
@categories = {}
|
21
21
|
@category_count = strategy_hash[:category_count].to_i
|
22
22
|
@category_size_limit = strategy_hash[:category_size_limit].to_i
|
23
23
|
@doc_count = strategy_hash[:doc_count].to_i
|
data/lib/omnicat/version.rb
CHANGED
data/omnicat.gemspec
CHANGED
@@ -4,20 +4,21 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'omnicat/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'omnicat'
|
8
8
|
spec.version = OmniCat::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
9
|
+
spec.authors = ['Mustafa Turan']
|
10
|
+
spec.email = ['mustafaturan.net@gmail.com']
|
11
11
|
spec.description = %q{A generalized framework for text classifications.}
|
12
12
|
spec.summary = spec.description
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
13
|
+
spec.homepage = 'https://github.com/mustafaturan/omnicat'
|
14
|
+
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = [
|
19
|
+
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.
|
22
|
-
spec.add_development_dependency
|
21
|
+
spec.add_dependency 'hashable', '~> 0.1.0'
|
22
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
23
|
+
spec.add_development_dependency 'rake'
|
23
24
|
end
|
@@ -1,2 +1,2 @@
|
|
1
1
|
require 'test/unit'
|
2
|
-
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'omnicat'))
|
2
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'omnicat'))
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omnicat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,8 +9,24 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-07-
|
12
|
+
date: 2013-07-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: hashable
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.1.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.1.0
|
14
30
|
- !ruby/object:Gem::Dependency
|
15
31
|
name: bundler
|
16
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -65,16 +81,14 @@ files:
|
|
65
81
|
- lib/omnicat/classifiers/strategy_internals/category.rb
|
66
82
|
- lib/omnicat/configuration.rb
|
67
83
|
- lib/omnicat/doc.rb
|
68
|
-
- lib/omnicat/hash.rb
|
69
84
|
- lib/omnicat/result.rb
|
70
85
|
- lib/omnicat/version.rb
|
71
|
-
- lib/test/test_helper.rb
|
72
|
-
- lib/test/unit/array_test.rb
|
73
|
-
- lib/test/unit/classifier_test.rb
|
74
|
-
- lib/test/unit/classifiers/strategy_test.rb
|
75
|
-
- lib/test/unit/doc_test.rb
|
76
|
-
- lib/test/unit/hash_test.rb
|
77
86
|
- omnicat.gemspec
|
87
|
+
- test/test_helper.rb
|
88
|
+
- test/unit/array_test.rb
|
89
|
+
- test/unit/classifier_test.rb
|
90
|
+
- test/unit/classifiers/strategy_test.rb
|
91
|
+
- test/unit/doc_test.rb
|
78
92
|
homepage: https://github.com/mustafaturan/omnicat
|
79
93
|
licenses:
|
80
94
|
- MIT
|
@@ -100,4 +114,9 @@ rubygems_version: 1.8.23
|
|
100
114
|
signing_key:
|
101
115
|
specification_version: 3
|
102
116
|
summary: A generalized framework for text classifications.
|
103
|
-
test_files:
|
117
|
+
test_files:
|
118
|
+
- test/test_helper.rb
|
119
|
+
- test/unit/array_test.rb
|
120
|
+
- test/unit/classifier_test.rb
|
121
|
+
- test/unit/classifiers/strategy_test.rb
|
122
|
+
- test/unit/doc_test.rb
|
data/lib/omnicat/hash.rb
DELETED
data/lib/test/unit/hash_test.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'test_helper'))
|
2
|
-
|
3
|
-
class TestHash < Test::Unit::TestCase
|
4
|
-
def test_to_hash
|
5
|
-
categories_hash = {
|
6
|
-
"pos" => { doc_count: 0, docs: {}, tokens: {}, token_count: 0 }
|
7
|
-
}
|
8
|
-
categories = OmniCat::Hash.new
|
9
|
-
categories["pos"] = OmniCat::Classifiers::StrategyInternals::Category.new(categories_hash["pos"])
|
10
|
-
assert_equal(categories_hash, categories.to_hash)
|
11
|
-
end
|
12
|
-
end
|