stuff-classifier-chinese 0.51
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +20 -0
- data/README.md +162 -0
- data/Rakefile +12 -0
- data/lib/stuff-classifier.rb +17 -0
- data/lib/stuff-classifier/base.rb +190 -0
- data/lib/stuff-classifier/bayes.rb +81 -0
- data/lib/stuff-classifier/storage.rb +122 -0
- data/lib/stuff-classifier/tf-idf.rb +45 -0
- data/lib/stuff-classifier/tokenizer.rb +96 -0
- data/lib/stuff-classifier/tokenizer/tokenizer_properties.rb +81 -0
- data/lib/stuff-classifier/version.rb +4 -0
- data/stuff-classifier.gemspec +36 -0
- data/test/helper.rb +50 -0
- data/test/test_001_tokenizer.rb +51 -0
- data/test/test_002_base.rb +39 -0
- data/test/test_003_naive_bayes.rb +57 -0
- data/test/test_004_tf_idf.rb +38 -0
- data/test/test_005_in_memory_storage.rb +32 -0
- data/test/test_006_file_storage.rb +78 -0
- data/test/test_007_redis_storage.rb +82 -0
- metadata +253 -0
@@ -0,0 +1,39 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require './helper'
|
3
|
+
|
4
|
+
|
5
|
+
class Test002Base < TestBase
|
6
|
+
before do
|
7
|
+
@cls = StuffClassifier::Bayes.new("Cats or Dogs")
|
8
|
+
set_classifier @cls
|
9
|
+
|
10
|
+
train :dog, "Dogs are awesome, cats too. I love my dog"
|
11
|
+
train :cat, "Cats are more preferred by software developers. I never could stand cats. I have a dog"
|
12
|
+
train :dog, "My dog's name is Willy. He likes to play with my wife's cat all day long. I love dogs"
|
13
|
+
train :cat, "Cats are difficult animals, unlike dogs, really annoying, I hate them all"
|
14
|
+
train :dog, "So which one should you choose? A dog, definitely."
|
15
|
+
train :cat, "The favorite food for cats is bird meat, although mice are good, but birds are a delicacy"
|
16
|
+
train :dog, "A dog will eat anything, including birds or whatever meat"
|
17
|
+
train :cat, "My cat's favorite place to purr is on my keyboard"
|
18
|
+
train :dog, "My dog's favorite place to take a leak is the tree in front of our house"
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_count
|
22
|
+
assert @cls.total_cat_count == 9
|
23
|
+
assert @cls.categories.map {|c| @cls.cat_count(c)}.inject(0){|s,count| s+count} == 9
|
24
|
+
|
25
|
+
|
26
|
+
# compare word count sum to word by cat count sum
|
27
|
+
assert @cls.word_list.map {|w| @cls.total_word_count(w[0]) }.inject(0) {|s,count| s+count} == 58
|
28
|
+
assert @cls.categories.map {|c| @cls.total_word_count_in_cat(c) }.inject(0){|s,count| s+count} == 58
|
29
|
+
|
30
|
+
# test word count by categories
|
31
|
+
assert @cls.word_list.map {|w| @cls.word_count(w[0],:dog) }.inject(0) {|s,count| s+count} == 29
|
32
|
+
assert @cls.word_list.map {|w| @cls.word_count(w[0],:cat) }.inject(0) {|s,count| s+count} == 29
|
33
|
+
|
34
|
+
# for all categories
|
35
|
+
assert @cls.categories.map {|c| @cls.word_list.map {|w| @cls.word_count(w[0],c) }.inject(0) {|s,count| s+count} }.inject(0){|s,count| s+count} == 58
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require './helper'
|
3
|
+
|
4
|
+
|
5
|
+
class Test003NaiveBayesClassification < TestBase
|
6
|
+
before do
|
7
|
+
set_classifier StuffClassifier::Bayes.new("Cats or Dogs")
|
8
|
+
|
9
|
+
train :dog, "Dogs are awesome, cats too. I love my dog"
|
10
|
+
train :cat, "Cats are more preferred by software developers. I never could stand cats. I have a dog"
|
11
|
+
train :dog, "My dog's name is Willy. He likes to play with my wife's cat all day long. I love dogs"
|
12
|
+
train :cat, "Cats are difficult animals, unlike dogs, really annoying, I hate them all"
|
13
|
+
train :dog, "So which one should you choose? A dog, definitely."
|
14
|
+
train :cat, "The favorite food for cats is bird meat, although mice are good, but birds are a delicacy"
|
15
|
+
train :dog, "A dog will eat anything, including birds or whatever meat"
|
16
|
+
train :cat, "My cat's favorite place to purr is on my keyboard"
|
17
|
+
train :dog, "My dog's favorite place to take a leak is the tree in front of our house"
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_for_cats
|
21
|
+
should_be :cat, "This test is about cats."
|
22
|
+
should_be :cat, "I hate ..."
|
23
|
+
should_be :cat, "The most annoying animal on earth."
|
24
|
+
should_be :cat, "The preferred company of software developers."
|
25
|
+
should_be :cat, "My precious, my favorite!"
|
26
|
+
should_be :cat, "Kill that bird!"
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_for_dogs
|
30
|
+
should_be :dog, "This test is about dogs."
|
31
|
+
should_be :dog, "Cats or Dogs?"
|
32
|
+
should_be :dog, "What pet will I love more?"
|
33
|
+
should_be :dog, "Willy, where the heck are you?"
|
34
|
+
should_be :dog, "I like big buts and I cannot lie."
|
35
|
+
should_be :dog, "Why is the front door of our house open?"
|
36
|
+
should_be :dog, "Who ate my meat?"
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_min_prob
|
40
|
+
classifier.min_prob = 0.001
|
41
|
+
should_be :cat, "This test is about cats."
|
42
|
+
should_be :cat, "I hate ..."
|
43
|
+
should_be nil, "The most annoying animal on earth."
|
44
|
+
should_be nil, "The preferred company of software developers."
|
45
|
+
should_be :cat, "My precious, my favorite!"
|
46
|
+
should_be :cat, "Kill that bird!"
|
47
|
+
should_be :dog, "This test is about dogs."
|
48
|
+
should_be :dog, "Cats or Dogs?"
|
49
|
+
should_be :dog, "What pet will I love more?"
|
50
|
+
should_be :dog, "Willy, where the heck are you?"
|
51
|
+
should_be nil, "I like big buts and I cannot lie."
|
52
|
+
should_be nil, "Why is the front door of our house open?"
|
53
|
+
should_be :dog, "Who ate my meat?"
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require './helper'
|
3
|
+
|
4
|
+
|
5
|
+
class Test004TfIdfClassification < TestBase
|
6
|
+
before do
|
7
|
+
set_classifier StuffClassifier::TfIdf.new("Cats or Dogs")
|
8
|
+
|
9
|
+
train :dog, "Dogs are awesome, cats too. I love my dog"
|
10
|
+
train :cat, "Cats are more preferred by software developers. I never could stand cats. I have a dog"
|
11
|
+
train :dog, "My dog's name is Willy. He likes to play with my wife's cat all day long. I love dogs"
|
12
|
+
train :cat, "Cats are difficult animals, unlike dogs, really annoying, I hate them all"
|
13
|
+
train :dog, "So which one should you choose? A dog, definitely."
|
14
|
+
train :cat, "The favorite food for cats is bird meat, although mice are good, but birds are a delicacy"
|
15
|
+
train :dog, "A dog will eat anything, including birds or whatever meat"
|
16
|
+
train :cat, "My cat's favorite place to purr is on my keyboard"
|
17
|
+
train :dog, "My dog's favorite place to take a leak is the tree in front of our house"
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_for_cats
|
21
|
+
should_be :cat, "This test is about cats."
|
22
|
+
should_be :cat, "I hate ..."
|
23
|
+
should_be :cat, "The most annoying animal on earth."
|
24
|
+
should_be :cat, "The preferred company of software developers."
|
25
|
+
should_be :cat, "My precious, my favorite!"
|
26
|
+
should_be :cat, "Kill that bird!"
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_for_dogs
|
30
|
+
should_be :dog, "This test is about dogs."
|
31
|
+
should_be :dog, "Cats or Dogs?"
|
32
|
+
should_be :dog, "What pet will I love more?"
|
33
|
+
should_be :dog, "Willy, where the heck are you?"
|
34
|
+
should_be :dog, "I like big buts and I cannot lie."
|
35
|
+
should_be :dog, "Why is the front door of our house open?"
|
36
|
+
should_be :dog, "Who is eating my meat?"
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require './helper'
|
3
|
+
|
4
|
+
|
5
|
+
class Test005InMemoryStorage < TestBase
|
6
|
+
before do
|
7
|
+
StuffClassifier::Base.storage = StuffClassifier::InMemoryStorage.new
|
8
|
+
|
9
|
+
StuffClassifier::Bayes.open("Cats or Dogs") do |cls|
|
10
|
+
cls.train(:dog, "Dogs are awesome, cats too. I love my dog")
|
11
|
+
cls.train(:cat, "Cats are more preferred by software developers. I never could stand cats. I have a dog")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_for_persistance
|
16
|
+
test = self
|
17
|
+
StuffClassifier::Bayes.new("Cats or Dogs").instance_eval do
|
18
|
+
test.assert @storage.instance_of?(StuffClassifier::InMemoryStorage),
|
19
|
+
"@storage should be an instance of FileStorage"
|
20
|
+
test.assert @word_list.length > 0, "Word count should be persisted"
|
21
|
+
test.assert @category_list.length > 0, "Category count should be persisted"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_purge_state
|
26
|
+
test = self
|
27
|
+
StuffClassifier::Bayes.new("Cats or Dogs", :purge_state => true).instance_eval do
|
28
|
+
test.assert @word_list.length == 0, "Word count should be purged"
|
29
|
+
test.assert @category_list.length == 0, "Category count should be purged"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require './helper'
|
3
|
+
|
4
|
+
|
5
|
+
class Test006FileStorage < TestBase
|
6
|
+
before do
|
7
|
+
@storage_path = "/tmp/test_classifier.db"
|
8
|
+
@storage = StuffClassifier::FileStorage.new(@storage_path)
|
9
|
+
StuffClassifier::Base.storage = @storage
|
10
|
+
|
11
|
+
StuffClassifier::Bayes.open("Cats or Dogs") do |cls|
|
12
|
+
cls.train(:dog, "Dogs are awesome, cats too. I love my dog.")
|
13
|
+
cls.train(:dog, "My dog's name is Willy. He likes to play with my wife's cat all day long. I love dogs")
|
14
|
+
cls.train(:dog, "So which one should you choose? A dog, definitely.")
|
15
|
+
cls.train(:dog, "A dog will eat anything, including birds or whatever meat")
|
16
|
+
cls.train(:dog, "My dog's favorite place to take a leak is the tree in front of our house")
|
17
|
+
|
18
|
+
cls.train(:cat, "My cat's favorite place to purr is on my keyboard")
|
19
|
+
cls.train(:cat, "The favorite food for cats is bird meat, although mice are good, but birds are a delicacy")
|
20
|
+
cls.train(:cat, "Cats are difficult animals, unlike dogs, really annoying, I hate them all")
|
21
|
+
cls.train(:cat, "Cats are more preferred by software developers. I never could stand cats. I have a dog")
|
22
|
+
end
|
23
|
+
|
24
|
+
# redefining storage instance, forcing it to read from file again
|
25
|
+
StuffClassifier::Base.storage = StuffClassifier::FileStorage.new(@storage_path)
|
26
|
+
end
|
27
|
+
|
28
|
+
def teardown
|
29
|
+
File.unlink @storage_path if File.exists? @storage_path
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_result
|
33
|
+
set_classifier StuffClassifier::Bayes.new("Cats or Dogs")
|
34
|
+
|
35
|
+
should_be :cat, "This test is about cats."
|
36
|
+
should_be :cat, "I hate ..."
|
37
|
+
should_be :cat, "The most annoying animal on earth."
|
38
|
+
should_be :cat, "The preferred company of software developers."
|
39
|
+
should_be :cat, "My precious, my favorite!"
|
40
|
+
should_be :cat, "Kill that bird!"
|
41
|
+
|
42
|
+
should_be :dog, "This test is about dogs."
|
43
|
+
should_be :dog, "Cats or Dogs?"
|
44
|
+
should_be :dog, "What pet will I love more?"
|
45
|
+
should_be :dog, "Willy, where the heck are you?"
|
46
|
+
should_be :dog, "I like big buts and I cannot lie."
|
47
|
+
should_be :dog, "Why is the front door of our house open?"
|
48
|
+
should_be :dog, "Who ate my meat?"
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_for_persistance
|
53
|
+
assert ! @storage.equal?(StuffClassifier::Base.storage),"Storage instance should not be the same"
|
54
|
+
|
55
|
+
test = self
|
56
|
+
StuffClassifier::Bayes.new("Cats or Dogs").instance_eval do
|
57
|
+
test.assert @storage.instance_of?(StuffClassifier::FileStorage),"@storage should be an instance of FileStorage"
|
58
|
+
test.assert @word_list.length > 0, "Word count should be persisted"
|
59
|
+
test.assert @category_list.length > 0, "Category count should be persisted"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_file_created
|
64
|
+
assert File.exist?(@storage_path), "File #@storage_path should exist"
|
65
|
+
|
66
|
+
content = File.read(@storage_path)
|
67
|
+
assert content.length > 100, "Serialized content should have more than 100 chars"
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_purge_state
|
71
|
+
test = self
|
72
|
+
StuffClassifier::Bayes.new("Cats or Dogs", :purge_state => true).instance_eval do
|
73
|
+
test.assert @storage.instance_of?(StuffClassifier::FileStorage),"@storage should be an instance of FileStorage"
|
74
|
+
test.assert @word_list.length == 0, "Word count should be purged"
|
75
|
+
test.assert @category_list.length == 0, "Category count should be purged"
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require './helper'
|
3
|
+
require 'redis'
|
4
|
+
|
5
|
+
|
6
|
+
class Test007RedisStorage < TestBase
|
7
|
+
before do
|
8
|
+
@key = "test_classifier"
|
9
|
+
@redis_options = { host: 'localhost', port: 6379 }
|
10
|
+
@redis = Redis.new(@redis_options)
|
11
|
+
|
12
|
+
@storage = StuffClassifier::RedisStorage.new(@key, @redis_options)
|
13
|
+
StuffClassifier::Base.storage = @storage
|
14
|
+
|
15
|
+
StuffClassifier::Bayes.open("Cats or Dogs") do |cls|
|
16
|
+
cls.train(:dog, "Dogs are awesome, cats too. I love my dog.")
|
17
|
+
cls.train(:dog, "My dog's name is Willy. He likes to play with my wife's cat all day long. I love dogs")
|
18
|
+
cls.train(:dog, "So which one should you choose? A dog, definitely.")
|
19
|
+
cls.train(:dog, "A dog will eat anything, including birds or whatever meat")
|
20
|
+
cls.train(:dog, "My dog's favorite place to take a leak is the tree in front of our house")
|
21
|
+
|
22
|
+
cls.train(:cat, "My cat's favorite place to purr is on my keyboard")
|
23
|
+
cls.train(:cat, "The favorite food for cats is bird meat, although mice are good, but birds are a delicacy")
|
24
|
+
cls.train(:cat, "Cats are difficult animals, unlike dogs, really annoying, I hate them all")
|
25
|
+
cls.train(:cat, "Cats are more preferred by software developers. I never could stand cats. I have a dog")
|
26
|
+
end
|
27
|
+
|
28
|
+
# redefining storage instance, forcing it to read from file again
|
29
|
+
StuffClassifier::Base.storage = StuffClassifier::RedisStorage.new(@key, @redis_options)
|
30
|
+
end
|
31
|
+
|
32
|
+
def teardown
|
33
|
+
@redis.del(@key)
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_result
|
37
|
+
set_classifier StuffClassifier::Bayes.new("Cats or Dogs")
|
38
|
+
|
39
|
+
should_be :cat, "This test is about cats."
|
40
|
+
should_be :cat, "I hate ..."
|
41
|
+
should_be :cat, "The most annoying animal on earth."
|
42
|
+
should_be :cat, "The preferred company of software developers."
|
43
|
+
should_be :cat, "My precious, my favorite!"
|
44
|
+
should_be :cat, "Kill that bird!"
|
45
|
+
|
46
|
+
should_be :dog, "This test is about dogs."
|
47
|
+
should_be :dog, "Cats or Dogs?"
|
48
|
+
should_be :dog, "What pet will I love more?"
|
49
|
+
should_be :dog, "Willy, where the heck are you?"
|
50
|
+
should_be :dog, "I like big buts and I cannot lie."
|
51
|
+
should_be :dog, "Why is the front door of our house open?"
|
52
|
+
should_be :dog, "Who ate my meat?"
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_for_persistance
|
57
|
+
assert !@storage.equal?(StuffClassifier::Base.storage),"Storage instance should not be the same"
|
58
|
+
|
59
|
+
test = self
|
60
|
+
StuffClassifier::Bayes.new("Cats or Dogs").instance_eval do
|
61
|
+
test.assert @storage.instance_of?(StuffClassifier::RedisStorage),"@storage should be an instance of RedisStorage"
|
62
|
+
test.assert @word_list.length > 0, "Word count should be persisted"
|
63
|
+
test.assert @category_list.length > 0, "Category count should be persisted"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_key_created
|
68
|
+
assert @redis.exists(@key), "Redis key #{@key} should exist"
|
69
|
+
|
70
|
+
content = @redis.get(@key)
|
71
|
+
assert content.length > 100, "Serialized content should have more than 100 chars"
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_purge_state
|
75
|
+
test = self
|
76
|
+
StuffClassifier::Bayes.new("Cats or Dogs", :purge_state => true).instance_eval do
|
77
|
+
test.assert @storage.instance_of?(StuffClassifier::RedisStorage),"@storage should be an instance of RedisStorage"
|
78
|
+
test.assert @word_list.length == 0, "Word count should be purged"
|
79
|
+
test.assert @category_list.length == 0, "Category count should be purged"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
metadata
ADDED
@@ -0,0 +1,253 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: stuff-classifier-chinese
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.51'
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Tim Lang
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-01-22 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: ruby-stemmer
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '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'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: sequel
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: redis
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: bundler
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rake
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 0.9.2
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 0.9.2
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: minitest
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ~>
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '4'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '4'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: turn
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.8.3
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 0.8.3
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: simplecov
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
- !ruby/object:Gem::Dependency
|
143
|
+
name: awesome_print
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
146
|
+
requirements:
|
147
|
+
- - ! '>='
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '0'
|
150
|
+
type: :development
|
151
|
+
prerelease: false
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - ! '>='
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
158
|
+
- !ruby/object:Gem::Dependency
|
159
|
+
name: rmmseg-cpp-huacnlee
|
160
|
+
requirement: !ruby/object:Gem::Requirement
|
161
|
+
none: false
|
162
|
+
requirements:
|
163
|
+
- - ! '>='
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
type: :development
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - ! '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
- !ruby/object:Gem::Dependency
|
175
|
+
name: debugger
|
176
|
+
requirement: !ruby/object:Gem::Requirement
|
177
|
+
none: false
|
178
|
+
requirements:
|
179
|
+
- - ! '>='
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: '0'
|
182
|
+
type: :development
|
183
|
+
prerelease: false
|
184
|
+
version_requirements: !ruby/object:Gem::Requirement
|
185
|
+
none: false
|
186
|
+
requirements:
|
187
|
+
- - ! '>='
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '0'
|
190
|
+
description: forked from https://github.com/alexandru/stuff-classifier, 2 methods
|
191
|
+
are provided for now - (1) naive bayes implementation + (2) tf-idf weights
|
192
|
+
email:
|
193
|
+
- langyong135@gmail.com
|
194
|
+
executables: []
|
195
|
+
extensions: []
|
196
|
+
extra_rdoc_files: []
|
197
|
+
files:
|
198
|
+
- .gitignore
|
199
|
+
- Gemfile
|
200
|
+
- LICENSE.txt
|
201
|
+
- README.md
|
202
|
+
- Rakefile
|
203
|
+
- lib/stuff-classifier.rb
|
204
|
+
- lib/stuff-classifier/base.rb
|
205
|
+
- lib/stuff-classifier/bayes.rb
|
206
|
+
- lib/stuff-classifier/storage.rb
|
207
|
+
- lib/stuff-classifier/tf-idf.rb
|
208
|
+
- lib/stuff-classifier/tokenizer.rb
|
209
|
+
- lib/stuff-classifier/tokenizer/tokenizer_properties.rb
|
210
|
+
- lib/stuff-classifier/version.rb
|
211
|
+
- stuff-classifier.gemspec
|
212
|
+
- test/helper.rb
|
213
|
+
- test/test_001_tokenizer.rb
|
214
|
+
- test/test_002_base.rb
|
215
|
+
- test/test_003_naive_bayes.rb
|
216
|
+
- test/test_004_tf_idf.rb
|
217
|
+
- test/test_005_in_memory_storage.rb
|
218
|
+
- test/test_006_file_storage.rb
|
219
|
+
- test/test_007_redis_storage.rb
|
220
|
+
homepage: https://github.com/TimLang/stuff-classifier/
|
221
|
+
licenses: []
|
222
|
+
post_install_message:
|
223
|
+
rdoc_options: []
|
224
|
+
require_paths:
|
225
|
+
- lib
|
226
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
227
|
+
none: false
|
228
|
+
requirements:
|
229
|
+
- - ! '>='
|
230
|
+
- !ruby/object:Gem::Version
|
231
|
+
version: 1.9.1
|
232
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
233
|
+
none: false
|
234
|
+
requirements:
|
235
|
+
- - ! '>='
|
236
|
+
- !ruby/object:Gem::Version
|
237
|
+
version: '0'
|
238
|
+
requirements: []
|
239
|
+
rubyforge_project:
|
240
|
+
rubygems_version: 1.8.25
|
241
|
+
signing_key:
|
242
|
+
specification_version: 3
|
243
|
+
summary: Simple text classifier(s) implemetation Chinese version
|
244
|
+
test_files:
|
245
|
+
- test/helper.rb
|
246
|
+
- test/test_001_tokenizer.rb
|
247
|
+
- test/test_002_base.rb
|
248
|
+
- test/test_003_naive_bayes.rb
|
249
|
+
- test/test_004_tf_idf.rb
|
250
|
+
- test/test_005_in_memory_storage.rb
|
251
|
+
- test/test_006_file_storage.rb
|
252
|
+
- test/test_007_redis_storage.rb
|
253
|
+
has_rdoc:
|