tiny-classifier 1.3 → 1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -0
- data/README.md +9 -3
- data/Rakefile +0 -0
- data/bin/tc-untrain +20 -0
- data/lib/tiny-classifier/base.rb +0 -0
- data/lib/tiny-classifier/classifier-generator.rb +0 -0
- data/lib/tiny-classifier/classifier.rb +0 -0
- data/lib/tiny-classifier/tokenizer.rb +0 -0
- data/lib/tiny-classifier/trainer.rb +0 -0
- data/lib/tiny-classifier/untrainer.rb +33 -0
- data/tiny-classifier.gemspec +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b3148d9ca8a78320d4190ae01c8c7db732db214
|
4
|
+
data.tar.gz: a04187f95459864895a08ab12b2c98d35332d1a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cd86f1c505edb833c97c54917656847f2592024ffa7e2977e1ee424d742e5f25bbd906de264c80251853b8c0daa2e74bd4380d38d614649371f7c16945550d6
|
7
|
+
data.tar.gz: ec6a4196ea142ef19e834cbba1d093c35f8f8f0b593e877793c345914bfa8d21e0fc11b88261bdaedb20b69963fdf5b95fdd6936d95231ce6d78907b5d05ba67
|
data/Gemfile
CHANGED
File without changes
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@ tiny-classifier
|
|
6
6
|
|
7
7
|
## Description
|
8
8
|
|
9
|
-
|
9
|
+
On-memory text classifier command line tool, based on naive bayes.
|
10
10
|
|
11
11
|
## Install
|
12
12
|
|
@@ -35,6 +35,12 @@ Training:
|
|
35
35
|
|
36
36
|
The training data will be saved as `tc.negative-positive.dat` (`tc.` is the fixed prefix, `.dat` is the fixed suffix. The middle part is filled by given labels automatically.) in the current directory. If you hope the file to be saved in any different place, please specify `--base-dir=/path/to/data/directory`.
|
37
37
|
|
38
|
+
Untraining for mistakes:
|
39
|
+
|
40
|
+
```
|
41
|
+
% echo "I'm so bad..." | tc-untrain --labels=positive,negative positive
|
42
|
+
```
|
43
|
+
|
38
44
|
Testing to classify:
|
39
45
|
|
40
46
|
~~~
|
@@ -70,9 +76,9 @@ positive
|
|
70
76
|
`-t`, `--tokenizer=TOKENIZER` (optional)
|
71
77
|
: Tokenizer for input which is not separated by whitespaces. Possible values are: only `mecab`.
|
72
78
|
|
73
|
-
### `tc-train` specific parameters
|
79
|
+
### `tc-train` and `tc-untrain` specific parameters
|
74
80
|
|
75
|
-
|
81
|
+
Both `tc-train` and `tc-untrain` require one command line argument: the label. You need to specify one of labels given via the `--labels` parameter.
|
76
82
|
|
77
83
|
### `tc-generate-classifier` specific parameters
|
78
84
|
|
data/Rakefile
CHANGED
File without changes
|
data/bin/tc-untrain
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# Copyright (C) 2017 YUKI "Piro" Hiroshi
|
4
|
+
#
|
5
|
+
# This program is free software: you can redistribute it and/or modify
|
6
|
+
# it under the terms of the GNU General Public License as published by
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
8
|
+
# (at your option) any later version.
|
9
|
+
#
|
10
|
+
# This program is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
# GNU General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU General Public License
|
16
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17
|
+
|
18
|
+
require "tiny-classifier/untrainer"
|
19
|
+
|
20
|
+
TinyClassifier::Unrrainer.run
|
data/lib/tiny-classifier/base.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Copyright (C) 2017 YUKI "Piro" Hiroshi
|
2
|
+
#
|
3
|
+
# This program is free software: you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU General Public License as published by
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
|
16
|
+
require "tiny-classifier/trainer"
|
17
|
+
|
18
|
+
module TinyClassifier
|
19
|
+
class Untrainer < Trainer
|
20
|
+
def run(params)
|
21
|
+
@label = params[:label]
|
22
|
+
prepare_label
|
23
|
+
if input.empty?
|
24
|
+
STDERR.puts("Error: No effective input.")
|
25
|
+
false
|
26
|
+
else
|
27
|
+
classifier.send("untrain_#{@label}", input)
|
28
|
+
save
|
29
|
+
true
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/tiny-classifier.gemspec
CHANGED
@@ -21,7 +21,7 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "lib"))
|
|
21
21
|
|
22
22
|
Gem::Specification.new do |spec|
|
23
23
|
spec.name = "tiny-classifier"
|
24
|
-
spec.version = "1.
|
24
|
+
spec.version = "1.4"
|
25
25
|
spec.homepage = "https://github.com/piroor/tiny-classifier"
|
26
26
|
spec.authors = ["YUKI \"Piro\" Hiroshi"]
|
27
27
|
spec.email = ["piro.outsider.reflex@gmail.com"]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tiny-classifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- YUKI "Piro" Hiroshi
|
@@ -42,9 +42,10 @@ description: ''
|
|
42
42
|
email:
|
43
43
|
- piro.outsider.reflex@gmail.com
|
44
44
|
executables:
|
45
|
+
- tc-classify
|
45
46
|
- tc-generate-classifier
|
46
47
|
- tc-train
|
47
|
-
- tc-
|
48
|
+
- tc-untrain
|
48
49
|
extensions: []
|
49
50
|
extra_rdoc_files: []
|
50
51
|
files:
|
@@ -54,11 +55,13 @@ files:
|
|
54
55
|
- bin/tc-classify
|
55
56
|
- bin/tc-generate-classifier
|
56
57
|
- bin/tc-train
|
58
|
+
- bin/tc-untrain
|
57
59
|
- lib/tiny-classifier/base.rb
|
58
60
|
- lib/tiny-classifier/classifier-generator.rb
|
59
61
|
- lib/tiny-classifier/classifier.rb
|
60
62
|
- lib/tiny-classifier/tokenizer.rb
|
61
63
|
- lib/tiny-classifier/trainer.rb
|
64
|
+
- lib/tiny-classifier/untrainer.rb
|
62
65
|
- tiny-classifier.gemspec
|
63
66
|
homepage: https://github.com/piroor/tiny-classifier
|
64
67
|
licenses:
|
@@ -83,5 +86,5 @@ rubyforge_project:
|
|
83
86
|
rubygems_version: 2.5.1
|
84
87
|
signing_key:
|
85
88
|
specification_version: 4
|
86
|
-
summary:
|
89
|
+
summary: On-memory text classifier command line tool, based on naive bayes.
|
87
90
|
test_files: []
|