mushikago-sdk 2.0.0 → 2.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.
- data/README.md +13 -10
- data/lib/mushikago/hanamgri/client.rb +4 -2
- data/lib/mushikago/hanamgri/delete_knowledge_request.rb +0 -1
- data/lib/mushikago/hanamgri/field.rb +1 -1
- data/lib/mushikago/hanamgri/list_knowledges_request.rb +0 -1
- data/lib/mushikago/hanamgri/save_knowledge_request.rb +3 -2
- data/lib/mushikago/hanamgri/search_schema_request.rb +2 -3
- data/lib/mushikago/hanamgri/train_request.rb +2 -0
- data/lib/mushikago/version.rb +1 -1
- data/spec/mushikago/hanamgri/client_spec.rb +1 -1
- data/spec/mushikago/hanamgri/save_knowledge_request_spec.rb +8 -7
- metadata +20 -20
data/README.md
CHANGED
@@ -2,11 +2,11 @@ Mushikago SDK for Ruby.
|
|
2
2
|
=======================
|
3
3
|
|
4
4
|
- **Homepage**: [http://www.mushikago.org/](http://www.mushikago.org/)
|
5
|
-
- **Author**:
|
5
|
+
- **Author**: MiningBrownie
|
6
6
|
- **Copyright**: 2011
|
7
7
|
- **License**: Apache License, Version 2.0
|
8
|
-
- **Latest Version**: 1.
|
9
|
-
- **Release Date**:
|
8
|
+
- **Latest Version**: 2.1.0
|
9
|
+
- **Release Date**: May 30th 2012
|
10
10
|
|
11
11
|
|
12
12
|
概要
|
@@ -18,13 +18,14 @@ Mushikago SDK for Ruby.
|
|
18
18
|
機能一覧
|
19
19
|
--------
|
20
20
|
|
21
|
-
**1.
|
22
|
-
キャプチャ画像にはタグをつけて管理することができます。
|
23
|
-
キャプチャ画像は非同期で取得され、サーバの混雑具合によってリクエストから取得まで最大1時間の時間差があります。
|
24
|
-
|
25
|
-
**2.mitsubachiを利用する**: [mitsubachi](http://www.mushikago.org/mitsubachi/)はウェブサイトをクローリングするためのクラウドプラットフォームサービスです。
|
21
|
+
**1.mitsubachiを利用する**: [mitsubachi](http://www.mushikago.org/mitsubachi/)はウェブサイトをクローリングするためのクラウドプラットフォームサービスです。
|
26
22
|
環境構築などの準備を一切必要とせず、ユーザーは簡易なスクリプトをmitsubachiサーバにアップロード するだけで、ウェブ上の欲しい情報を高速に収集し保存します。ユーザーは、少しの技術力とアイデアを持っていれば、新たなクローラビジネスを始める事ができます。
|
27
23
|
|
24
|
+
**2.hotaruを利用する**: [hotaru](http://www.mushikago.org/hotaru/)とは、自然言語処理を行うSaaS型のサービスです。
|
25
|
+
hotaruは日本語や英語など、多言語の解析に対応でき、それらの機能を初期費用が掛からず安価なコストから利用できます。また、同じmushikagoのサービスであるmitsubachiを使って、ウェブ上のレビューやブログなどの文章を取得してhotaruで解析するといった様に、 mushikago内のサービスと連携しやすいことも大きな利点です。
|
26
|
+
|
27
|
+
**3.hanamgriを利用する**: [hanamgri](http://www.mushikago.org/hanamgri/)とは、さまざまなレイアウトのウェブページから特定のデータを抽出するサービスです。
|
28
|
+
webサイトの構成やレイアウトを意識することなく「欲しい項目」「欲しい項目の周辺にありそうなキーワード」「欲しい情報がありそうなURL」をhanamgriに渡すだけで利用できます。
|
28
29
|
|
29
30
|
インストール方法
|
30
31
|
----------------
|
@@ -153,8 +154,10 @@ $ export MUSHIKAGO_SECRET_KEY=<シークレットキー>
|
|
153
154
|
変更履歴
|
154
155
|
--------
|
155
156
|
|
156
|
-
- **May.
|
157
|
-
-
|
157
|
+
- **May.30.12**: 2.1.0 release
|
158
|
+
- hanamgri(β)サポート
|
159
|
+
- **May.23.12**: 2.0.0 release
|
160
|
+
- hanamgriのベータサポート
|
158
161
|
- **Feb.20.12**: 0.4.2 release
|
159
162
|
- tomboのcaptureオプション「delay_time」に対応
|
160
163
|
- **Feb.20.12**: 0.4.0 release
|
@@ -176,6 +176,7 @@ module Mushikago
|
|
176
176
|
# @param [String] domain_name ドメイン名
|
177
177
|
# @param [String] url_or_html 学習対象のURLもしくはHTML文字列
|
178
178
|
# @param [Mushikago::Hanamgri::TrainingData] training_data 学習データ
|
179
|
+
# @option options [String] : :charset 学習対象URLもしくはHTML文字列の文字コード
|
179
180
|
# @return [Mushikagp::Http::Response] リクエストの結果
|
180
181
|
def train domain_name, url_or_html, training_data, options={}
|
181
182
|
request = Hanamgri::TrainRequest.new(domain_name, url_or_html, training_data, options)
|
@@ -226,10 +227,11 @@ module Mushikago
|
|
226
227
|
# client.save_knowledge('ec', {:description => '学習データの説明'})
|
227
228
|
#
|
228
229
|
# @param [String] domain_name ドメイン名
|
230
|
+
# @param [String] field_name フィールド名
|
229
231
|
# @param [Hash] options オプション
|
230
232
|
# @option options [String] :description 学習データの説明
|
231
|
-
def save_knowledge domain_name, options={}
|
232
|
-
request = Hanamgri::SaveKnowledgeRequest.new(domain_name, options)
|
233
|
+
def save_knowledge domain_name, field_name, options={}
|
234
|
+
request = Hanamgri::SaveKnowledgeRequest.new(domain_name, field_name, options)
|
233
235
|
send_request(request)
|
234
236
|
end
|
235
237
|
|
@@ -9,7 +9,6 @@ module Mushikago
|
|
9
9
|
|
10
10
|
def initialize options={}
|
11
11
|
super(options)
|
12
|
-
raise 'Unsupported Operation.'
|
13
12
|
self.limit = options[:limit] if options.has_key?(:limit)
|
14
13
|
self.offset = options[:offset] if options.has_key?(:offset)
|
15
14
|
self.status = options[:status] if options.has_key?(:status)
|
@@ -4,12 +4,13 @@ module Mushikago
|
|
4
4
|
class SaveKnowledgeRequest < Mushikago::Http::PutRequest
|
5
5
|
def path; "/1/hanamgri/knowledge" end
|
6
6
|
request_parameter :domain_name
|
7
|
+
request_parameter :field_name
|
7
8
|
request_parameter :description
|
8
9
|
|
9
|
-
def initialize domain_name, options={}
|
10
|
+
def initialize domain_name, field_name, options={}
|
10
11
|
super(options)
|
11
|
-
raise 'Unsupported Operation.'
|
12
12
|
self.domain_name = domain_name
|
13
|
+
self.field_name = field_name
|
13
14
|
self.description = options[:description] if options.has_key?(:description)
|
14
15
|
end
|
15
16
|
end
|
@@ -4,12 +4,11 @@ module Mushikago
|
|
4
4
|
class SearchSchemaRequest < Mushikago::Http::GetRequest
|
5
5
|
def path; "/1/hanamgri/domains/#{domain_name}/schema/search" end
|
6
6
|
attr_accessor :domain_name
|
7
|
-
|
8
|
-
|
7
|
+
request_parameter :query_key
|
8
|
+
request_parameter :query_value
|
9
9
|
|
10
10
|
def initialize domain_name, query_key, query_value, options={}
|
11
11
|
super(options)
|
12
|
-
raise 'Unsupported Operation.'
|
13
12
|
self.domain_name = domain_name
|
14
13
|
self.query_key = query_key
|
15
14
|
self.query_value = query_value
|
@@ -6,6 +6,7 @@ module Mushikago
|
|
6
6
|
attr_accessor :domain_name
|
7
7
|
request_parameter :url_or_html
|
8
8
|
request_parameter :training_data do |s| s.to_json end
|
9
|
+
request_parameter :charset
|
9
10
|
|
10
11
|
def initialize domain_name, url_or_html, training_data, options={}
|
11
12
|
super(options)
|
@@ -13,6 +14,7 @@ module Mushikago
|
|
13
14
|
self.domain_name = domain_name
|
14
15
|
self.url_or_html = url_or_html
|
15
16
|
self.training_data = training_data
|
17
|
+
self.charset = options[:charset] if options.has_key?(:charset)
|
16
18
|
end
|
17
19
|
end
|
18
20
|
end
|
data/lib/mushikago/version.rb
CHANGED
@@ -36,7 +36,7 @@ describe Mushikago::Hanamgri::Client do
|
|
36
36
|
[:save_dictionary, Mushikago::Hanamgri::SaveDictionaryRequest, ['domain_name', {:description => '辞書の説明'}]],
|
37
37
|
[:list_dictionaries, Mushikago::Hanamgri::ListDictionariesRequest, [{:limit => 3, :offset => 2}]],
|
38
38
|
[:delete_dictionary, Mushikago::Hanamgri::DeleteDictionaryRequest, ['dictionary_name', {}]],
|
39
|
-
[:save_knowledge, Mushikago::Hanamgri::SaveKnowledgeRequest, ['domain_name', {:description => '学習データの説明'}]],
|
39
|
+
[:save_knowledge, Mushikago::Hanamgri::SaveKnowledgeRequest, ['domain_name', 'field_name', {:description => '学習データの説明'}]],
|
40
40
|
[:list_knowledges, Mushikago::Hanamgri::ListKnowledgesRequest, [{:limit => 3, :offset => 2, :status => 'complete'}]],
|
41
41
|
[:delete_knowledge, Mushikago::Hanamgri::DeleteKnowledgeRequest, ['knowledge_name', {}]],
|
42
42
|
].each do |method_name, clazz, args|
|
@@ -2,20 +2,21 @@
|
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
4
|
describe Mushikago::Hanamgri::SaveKnowledgeRequest do
|
5
|
-
shared_examples_for 'a valid request instance for save_knowledge' do |n, o|
|
6
|
-
subject{ Mushikago::Hanamgri::SaveKnowledgeRequest.new(n, o) }
|
5
|
+
shared_examples_for 'a valid request instance for save_knowledge' do |n, f, o|
|
6
|
+
subject{ Mushikago::Hanamgri::SaveKnowledgeRequest.new(n, f, o) }
|
7
7
|
it{ should be_kind_of(Mushikago::Http::PutRequest) }
|
8
8
|
its(:path){ should == "/1/hanamgri/knowledge" }
|
9
9
|
its(:domain_name){ should == n }
|
10
|
+
its(:field_name){ should == f }
|
10
11
|
its(:description){ should == o[:description] }
|
11
12
|
end
|
12
13
|
|
13
14
|
test_parameters = [
|
14
|
-
['domain_name', {}],
|
15
|
-
['name', {:description => '学習データの説明'}],
|
16
|
-
].each do |n, o|
|
17
|
-
context ".new(#{n}, #{o})" do
|
18
|
-
it_should_behave_like 'a valid request instance for save_knowledge', n, o
|
15
|
+
['domain_name', 'field_name', {}],
|
16
|
+
['name', 'field_name', {:description => '学習データの説明'}],
|
17
|
+
].each do |n, f, o|
|
18
|
+
context ".new(#{n}, #{f}, #{o})" do
|
19
|
+
it_should_behave_like 'a valid request instance for save_knowledge', n, f, o
|
19
20
|
end
|
20
21
|
end
|
21
22
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mushikago-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-06-01 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
16
|
-
requirement: &
|
16
|
+
requirement: &9234520 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *9234520
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: mime-types
|
27
|
-
requirement: &
|
27
|
+
requirement: &9234080 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *9234080
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake
|
38
|
-
requirement: &
|
38
|
+
requirement: &9264640 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *9264640
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: maruku
|
49
|
-
requirement: &
|
49
|
+
requirement: &9264220 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *9264220
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: yard
|
60
|
-
requirement: &
|
60
|
+
requirement: &9263800 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *9263800
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
|
-
requirement: &
|
71
|
+
requirement: &9263300 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 2.6.0
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *9263300
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: ci_reporter
|
82
|
-
requirement: &
|
82
|
+
requirement: &9262880 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *9262880
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: ZenTest
|
93
|
-
requirement: &
|
93
|
+
requirement: &9262420 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *9262420
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: bundler
|
104
|
-
requirement: &
|
104
|
+
requirement: &9262000 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
version: '0'
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *9262000
|
113
113
|
description: A SDK for Mushikago Web Service.
|
114
114
|
email:
|
115
115
|
- t.matsuoka@miningbrownie.co.jp
|