monkeylearn 0.1 → 0.2
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 +4 -4
- data/README.md +7 -4
- data/lib/monkeylearn/classifiers.rb +6 -3
- data/monkeylearn.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ec517084ef75738ba6423156f745ea98276f30d
|
4
|
+
data.tar.gz: 612bdf407268f030674086083cb64328c73d6484
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8857e3a142c1da9aa2ce513b23dbe640d18c7a6531a265b890e27bf294d593f3544652cda3c563bc8df505774645a98bee2f323b8cb02ee1d12a6b64a101c74a
|
7
|
+
data.tar.gz: eeaf7ae4022a18376f6a892ad088ee22b50805467e82b2c671490337d9068af286d4686253f9ff38a4915057166e22ae3ce293e30beb21fbaa43bd0f5a425108
|
data/README.md
CHANGED
@@ -88,10 +88,13 @@ negative_category_id = r.result['result']['category']['id']
|
|
88
88
|
Upload some samples to each category:
|
89
89
|
|
90
90
|
```ruby
|
91
|
-
samples =
|
92
|
-
|
93
|
-
|
94
|
-
|
91
|
+
samples = [
|
92
|
+
['Nice beatiful', positive_category_id],
|
93
|
+
['awesome excelent', positive_category_id],
|
94
|
+
['Awful bad', negative_category_id],
|
95
|
+
['sad pale', negative_category_id],
|
96
|
+
['happy sad both multilabel', [positive_category_id, negative_category_id]]
|
97
|
+
]
|
95
98
|
r = Monkeylearn.classifiers.upload_samples(classifier_id, samples)
|
96
99
|
```
|
97
100
|
|
@@ -74,11 +74,14 @@ module Monkeylearn
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def upload_samples(module_id, samples_with_categories)
|
77
|
+
unless samples_with_categories.respond_to? :each
|
78
|
+
raise MonkeylearnError, "The second param must be an enumerable type (i.e. an Array)."
|
79
|
+
end
|
77
80
|
endpoint = build_endpoint(module_id, 'samples')
|
78
81
|
data = {
|
79
|
-
samples: samples_with_categories.collect do |
|
80
|
-
|
81
|
-
end
|
82
|
+
samples: samples_with_categories.collect do |text, category_ids|
|
83
|
+
{text: text, category_id: category_ids}
|
84
|
+
end
|
82
85
|
}
|
83
86
|
request :post, endpoint, data
|
84
87
|
end
|
data/monkeylearn.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ['hello@monkeylearn.com']
|
11
11
|
spec.homepage = 'https://github.com/monkeylearn/monkeylearn-ruby'
|
12
12
|
|
13
|
-
spec.version = '0.
|
13
|
+
spec.version = '0.2'
|
14
14
|
spec.add_dependency 'faraday', '>= 0.9.2'
|
15
15
|
|
16
16
|
spec.licenses = ['MIT']
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: monkeylearn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Monkeylearn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|