mocodo 0.1.0 → 0.1.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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/example/example.rb +198 -0
- data/lib/mocodo.rb +9 -7
- data/lib/mocodo/base.rb +56 -0
- data/lib/mocodo/character_recognition.rb +49 -169
- data/lib/mocodo/dialogue.rb +14 -39
- data/lib/mocodo/goo_language_analysis.rb +37 -141
- data/lib/mocodo/image_recognition.rb +13 -38
- data/lib/mocodo/knowledge_qa.rb +6 -17
- data/lib/mocodo/mountain_identification.rb +31 -0
- data/lib/mocodo/scenario_dialogue.rb +17 -0
- data/lib/mocodo/sentence_understanding.rb +4 -47
- data/lib/mocodo/text_to_speech.rb +53 -71
- data/lib/mocodo/version.rb +1 -1
- data/lib/mocodo/web_curation.rb +20 -63
- metadata +19 -17
- data/example/hqdefault.jpg +0 -0
- data/example/mocodo-example.rb +0 -134
- data/lib/mocodo/client.rb +0 -15
|
@@ -1,82 +1,64 @@
|
|
|
1
|
-
require 'net/https'
|
|
2
|
-
require 'open-uri'
|
|
3
|
-
require 'json'
|
|
4
|
-
|
|
5
1
|
module Mocodo
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def configure(options = {})
|
|
15
|
-
options.each do |key, value|
|
|
16
|
-
self.config[key] = value
|
|
2
|
+
module TextToSpeech
|
|
3
|
+
module AiTalk
|
|
4
|
+
class AiTalkBase < Base
|
|
5
|
+
EndPoint = "/aiTalk/v1/textToSpeech"
|
|
6
|
+
def header(content)
|
|
7
|
+
{'Content-Type'=>content, 'Accept'=>'audio/L16'}
|
|
8
|
+
end
|
|
17
9
|
end
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
10
|
+
|
|
11
|
+
class Ssml < AiTalkBase
|
|
12
|
+
def speech text
|
|
13
|
+
post(build_url(EndPoint), text, header('application/ssml+xml'))
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
class Kana < AiTalkBase
|
|
18
|
+
def speech text
|
|
19
|
+
post(build_url(EndPoint), text, header('application/x-aitalk-kana'))
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
class JeitaKana < AiTalkBase
|
|
24
|
+
def speech text
|
|
25
|
+
post(build_url(EndPoint), text, header('text/x-jeita-6004-kana'))
|
|
26
|
+
end
|
|
25
27
|
end
|
|
26
28
|
end
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return body.to_json
|
|
29
|
+
|
|
30
|
+
class VoiceText < Base
|
|
31
|
+
EndPoint = "/voiceText/v1/textToSpeech"
|
|
32
|
+
|
|
33
|
+
def speech(options={})
|
|
34
|
+
post(build_url(EndPoint), build_params(options), {'Content-Type'=>'application/x-www-form-urlencoded'})
|
|
35
|
+
end
|
|
35
36
|
end
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
request.body = build_body(text)
|
|
45
|
-
response = nil
|
|
46
|
-
http.start do |h|
|
|
47
|
-
response = h.request(request).body
|
|
37
|
+
|
|
38
|
+
module Crayon
|
|
39
|
+
class TextToSpeech < Base
|
|
40
|
+
EndPoint = "/crayon/v1/textToSpeech"
|
|
41
|
+
|
|
42
|
+
def speech(options={})
|
|
43
|
+
post(build_url(EndPoint), options.to_json, {'Content-Type'=>'application/json'})
|
|
44
|
+
end
|
|
48
45
|
end
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
http = Net::HTTP.new('api.apigw.smt.docomo.ne.jp', 443)
|
|
57
|
-
http.use_ssl = true
|
|
58
|
-
request = Net::HTTP::Post.new(uri.request_uri, {'Content-Type' =>'application/json'})
|
|
59
|
-
request.body = build_body(text)
|
|
60
|
-
response = nil
|
|
61
|
-
http.start do |h|
|
|
62
|
-
response = h.request(request).body
|
|
46
|
+
|
|
47
|
+
class TextToSpeechSsml < Base
|
|
48
|
+
EndPoint = "/crayon/v1/textToSpeechSsml"
|
|
49
|
+
|
|
50
|
+
def speech(options={})
|
|
51
|
+
post(build_url(EndPoint), options.to_json, {'Content-Type'=>'application/json'})
|
|
52
|
+
end
|
|
63
53
|
end
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
http = Net::HTTP.new('api.apigw.smt.docomo.ne.jp', 443)
|
|
72
|
-
http.use_ssl = true
|
|
73
|
-
request = Net::HTTP::Post.new(uri.request_uri, {'Content-Type' =>'application/json'})
|
|
74
|
-
request.body = build_body(text)
|
|
75
|
-
response = nil
|
|
76
|
-
http.start do |h|
|
|
77
|
-
response = h.request(request).body
|
|
54
|
+
|
|
55
|
+
class TextToSpeechKanaAccent < Base
|
|
56
|
+
EndPoint = "/crayon/v1/textToSpeechKanaAccent"
|
|
57
|
+
|
|
58
|
+
def speech(options={})
|
|
59
|
+
post(build_url(EndPoint), options.to_json, {'Content-Type'=>'application/json'})
|
|
60
|
+
end
|
|
78
61
|
end
|
|
79
|
-
return response
|
|
80
62
|
end
|
|
81
63
|
end
|
|
82
64
|
end
|
data/lib/mocodo/version.rb
CHANGED
data/lib/mocodo/web_curation.rb
CHANGED
|
@@ -1,74 +1,31 @@
|
|
|
1
|
-
require 'net/https'
|
|
2
|
-
require 'json'
|
|
3
|
-
|
|
4
1
|
module Mocodo
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def build_url(options = {})
|
|
11
|
-
url = ""
|
|
12
|
-
options.each do |key, value|
|
|
13
|
-
url << "&" << key.id2name << "=" << value
|
|
14
|
-
end
|
|
15
|
-
return URI.escape(url)
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
class Genre < WebCuration
|
|
20
|
-
def get_genre(conf = {})
|
|
21
|
-
uri = URI.parse("https://api.apigw.smt.docomo.ne.jp/webCuration/v3/genre?APIKEY=#{@client.get_api_key}#{build_url(conf)}")
|
|
22
|
-
http = Net::HTTP.new('api.apigw.smt.docomo.ne.jp', 443)
|
|
23
|
-
http.use_ssl = true
|
|
24
|
-
request = Net::HTTP::Get.new(uri.request_uri)
|
|
25
|
-
response = nil
|
|
26
|
-
http.start do |h|
|
|
27
|
-
response = JSON.parse(h.request(request).body, symbolize_names: true)
|
|
2
|
+
module WebCuration
|
|
3
|
+
class Genre < Base
|
|
4
|
+
EndPoint = "/webCuration/v3/genre"
|
|
5
|
+
def get(options={})
|
|
6
|
+
JSON.parse(open(build_url(EndPoint, options)).read, symbolize_names: true)
|
|
28
7
|
end
|
|
29
|
-
return response
|
|
30
8
|
end
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
http = Net::HTTP.new('api.apigw.smt.docomo.ne.jp', 443)
|
|
37
|
-
http.use_ssl = true
|
|
38
|
-
request = Net::HTTP::Get.new(uri.request_uri)
|
|
39
|
-
response = nil
|
|
40
|
-
http.start do |h|
|
|
41
|
-
response = JSON.parse(h.request(request).body, symbolize_names: true)
|
|
9
|
+
|
|
10
|
+
class Contents < Base
|
|
11
|
+
EndPoint = "/webCuration/v3/contents"
|
|
12
|
+
def get(options={})
|
|
13
|
+
JSON.parse(open(build_url(EndPoint, options)).read, symbolize_names: true)
|
|
42
14
|
end
|
|
43
|
-
return response
|
|
44
15
|
end
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
http = Net::HTTP.new('api.apigw.smt.docomo.ne.jp', 443)
|
|
51
|
-
http.use_ssl = true
|
|
52
|
-
request = Net::HTTP::Get.new(uri.request_uri)
|
|
53
|
-
response = nil
|
|
54
|
-
http.start do |h|
|
|
55
|
-
response = JSON.parse(h.request(request).body, symbolize_names: true)
|
|
16
|
+
|
|
17
|
+
class RelatedContents < Base
|
|
18
|
+
EndPoint = "/webCuration/v3/relatedContents"
|
|
19
|
+
def get(options={})
|
|
20
|
+
JSON.parse(open(build_url(EndPoint, options)).read, symbolize_names: true)
|
|
56
21
|
end
|
|
57
|
-
return response
|
|
58
22
|
end
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
http = Net::HTTP.new('api.apigw.smt.docomo.ne.jp', 443)
|
|
65
|
-
http.use_ssl = true
|
|
66
|
-
request = Net::HTTP::Get.new(uri.request_uri)
|
|
67
|
-
response = nil
|
|
68
|
-
http.start do |h|
|
|
69
|
-
response = JSON.parse(h.request(request).body, symbolize_names: true)
|
|
23
|
+
|
|
24
|
+
class Search < Base
|
|
25
|
+
EndPoint = "/webCuration/v3/search"
|
|
26
|
+
def get(options={})
|
|
27
|
+
JSON.parse(open(build_url(EndPoint, options)).read, symbolize_names: true)
|
|
70
28
|
end
|
|
71
|
-
return response
|
|
72
29
|
end
|
|
73
30
|
end
|
|
74
31
|
end
|
metadata
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mocodo
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- flum1025
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-
|
|
11
|
+
date: 2016-09-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - ~>
|
|
17
|
+
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
19
|
version: '1.9'
|
|
20
20
|
type: :development
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
|
-
- - ~>
|
|
24
|
+
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '1.9'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: rake
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
|
-
- - ~>
|
|
31
|
+
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
33
|
version: '10.0'
|
|
34
34
|
type: :development
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
|
-
- - ~>
|
|
38
|
+
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: '10.0'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: json
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
|
-
- -
|
|
45
|
+
- - ">="
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
47
|
version: '0'
|
|
48
48
|
type: :runtime
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
|
-
- -
|
|
52
|
+
- - ">="
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '0'
|
|
55
55
|
description: Docomo Api Library
|
|
@@ -59,23 +59,24 @@ executables: []
|
|
|
59
59
|
extensions: []
|
|
60
60
|
extra_rdoc_files: []
|
|
61
61
|
files:
|
|
62
|
-
- .gitignore
|
|
63
|
-
- .project
|
|
64
|
-
- .travis.yml
|
|
62
|
+
- ".gitignore"
|
|
63
|
+
- ".project"
|
|
64
|
+
- ".travis.yml"
|
|
65
65
|
- Gemfile
|
|
66
66
|
- README.md
|
|
67
67
|
- Rakefile
|
|
68
68
|
- bin/console
|
|
69
69
|
- bin/setup
|
|
70
|
-
- example/
|
|
71
|
-
- example/mocodo-example.rb
|
|
70
|
+
- example/example.rb
|
|
72
71
|
- lib/mocodo.rb
|
|
72
|
+
- lib/mocodo/base.rb
|
|
73
73
|
- lib/mocodo/character_recognition.rb
|
|
74
|
-
- lib/mocodo/client.rb
|
|
75
74
|
- lib/mocodo/dialogue.rb
|
|
76
75
|
- lib/mocodo/goo_language_analysis.rb
|
|
77
76
|
- lib/mocodo/image_recognition.rb
|
|
78
77
|
- lib/mocodo/knowledge_qa.rb
|
|
78
|
+
- lib/mocodo/mountain_identification.rb
|
|
79
|
+
- lib/mocodo/scenario_dialogue.rb
|
|
79
80
|
- lib/mocodo/sentence_understanding.rb
|
|
80
81
|
- lib/mocodo/text_to_speech.rb
|
|
81
82
|
- lib/mocodo/version.rb
|
|
@@ -90,18 +91,19 @@ require_paths:
|
|
|
90
91
|
- lib
|
|
91
92
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
92
93
|
requirements:
|
|
93
|
-
- -
|
|
94
|
+
- - ">="
|
|
94
95
|
- !ruby/object:Gem::Version
|
|
95
96
|
version: '0'
|
|
96
97
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
98
|
requirements:
|
|
98
|
-
- -
|
|
99
|
+
- - ">="
|
|
99
100
|
- !ruby/object:Gem::Version
|
|
100
101
|
version: '0'
|
|
101
102
|
requirements: []
|
|
102
103
|
rubyforge_project:
|
|
103
|
-
rubygems_version: 2.5.
|
|
104
|
+
rubygems_version: 2.5.1
|
|
104
105
|
signing_key:
|
|
105
106
|
specification_version: 4
|
|
106
107
|
summary: Docomo Api Library
|
|
107
108
|
test_files: []
|
|
109
|
+
has_rdoc:
|
data/example/hqdefault.jpg
DELETED
|
Binary file
|
data/example/mocodo-example.rb
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
# Coding: UTF-8
|
|
2
|
-
lib = File.expand_path('../../lib', __FILE__)
|
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
-
require 'mocodo'
|
|
5
|
-
|
|
6
|
-
api_key = ''
|
|
7
|
-
|
|
8
|
-
###Mocodoの使用例
|
|
9
|
-
####詳しい説明は https://github.com/flum1025/Mocodo
|
|
10
|
-
####apiについての説明は https://dev.smt.docomo.ne.jp/?p=docs.api.page&api_name=image_recognition&p_name=api_usage_scenario
|
|
11
|
-
####公式サイトは https://dev.smt.docomo.ne.jp/?p=index
|
|
12
|
-
|
|
13
|
-
###Copyright c @flum_ 2015
|
|
14
|
-
###Twitter:@flum https://twitter.com/flum_
|
|
15
|
-
###WEBサイト http://flum.pw/
|
|
16
|
-
|
|
17
|
-
###画像認識
|
|
18
|
-
recognize = Mocodo::Recognize.new(api_key)
|
|
19
|
-
p recognize.image_recognition('http://i.ytimg.com/vi/kmqAuILzS14/hqdefault.jpg') #WEB上のがそうURL
|
|
20
|
-
p recognize.local_image_recognition(File.join(path, 'mocodo/hqdefault.jpg')) #ローカルの画像パス
|
|
21
|
-
###発話理解
|
|
22
|
-
sentence = Mocodo::SentenceUnderstanding.new(api_key)
|
|
23
|
-
sentence.configure config = {
|
|
24
|
-
:projectKey=> "OSU",
|
|
25
|
-
:appInfo=> {
|
|
26
|
-
:appName=> "hoge_app",
|
|
27
|
-
:appKey=> "hoge_app01"
|
|
28
|
-
},
|
|
29
|
-
:clientVer=> "1.0.0",
|
|
30
|
-
:dialogMode=> "off",
|
|
31
|
-
:language=> "ja",
|
|
32
|
-
:userId=> "fly",
|
|
33
|
-
:location=> {
|
|
34
|
-
:lat=> "139.766084",
|
|
35
|
-
:lon=> "35.681382",
|
|
36
|
-
},
|
|
37
|
-
}
|
|
38
|
-
sentence.sentenceUnderstanding("電話して")
|
|
39
|
-
sentence.get_current_data
|
|
40
|
-
|
|
41
|
-
###音声合成
|
|
42
|
-
###共通概要
|
|
43
|
-
#レスポンスは全てbinary形式です。
|
|
44
|
-
###漢字かな混じり文
|
|
45
|
-
textToSpeech = Mocodo::TextToSpeech.new(api_key)
|
|
46
|
-
textToSpeech.configure config = {
|
|
47
|
-
:Command=> "AP_Synth",
|
|
48
|
-
:SpeechRate=> "1.15",
|
|
49
|
-
:AudioFileFormat=> "0",
|
|
50
|
-
}
|
|
51
|
-
binary1 = textToSpeech.textToSpeech "のあちゃんかわいい"
|
|
52
|
-
###SSML
|
|
53
|
-
textToSpeechSsml = Mocodo::TextToSpeechSsml.new(api_key)
|
|
54
|
-
binary2 = textToSpeechSsml.textToSpeech "ゆあちゃんかわいい"
|
|
55
|
-
###カナアクセント文
|
|
56
|
-
textToSpeechKanaAccent = Mocodo::TextToSpeechKanaAccent.new(api_key)
|
|
57
|
-
binary3 = textToSpeechKanaAccent.textToSpeech "ふらんちゃんちゃんかわいい"
|
|
58
|
-
|
|
59
|
-
###文字認識
|
|
60
|
-
###共通概要
|
|
61
|
-
#現時点ではエラーが出て使えません。lib/characterRecognition.rb内のimage_openでの画像の読み込み方法を変えれば、全てのメソッドが使えるようになりそうですが、いまいちわからないのでこのまま。
|
|
62
|
-
#わかる方いたらプルリクお願いします。
|
|
63
|
-
###情景画像認識要求
|
|
64
|
-
scene = Mocodo::SceneRecognition.new(api_key)
|
|
65
|
-
scene.recognitionRequest('http://i.ytimg.com/vi/kmqAuILzS14/hqdefault.jpg')
|
|
66
|
-
###情景画像認識結果取得
|
|
67
|
-
#scene.getRecognition #recognitionRequestを実行していればidは自動で入力されます。引数で直接指定もできます。
|
|
68
|
-
###情景画像認識取消
|
|
69
|
-
#scene.cancelRecognition #recognitionRequestを実行していればidは自動で入力されます。引数で直接指定もできます。
|
|
70
|
-
###行画像認識要求
|
|
71
|
-
line = Mocodo::Line.new(api_key)
|
|
72
|
-
line.get_line('http://i.ytimg.com/vi/kmqAuILzS14/hqdefault.jpg')
|
|
73
|
-
###文章画像認識要求
|
|
74
|
-
document = Mocodo::DocumentRecognition.new(api_key)
|
|
75
|
-
document.recognitionRequest('http://i.ytimg.com/vi/kmqAuILzS14/hqdefault.jpg')
|
|
76
|
-
###文章画像認識結果取得
|
|
77
|
-
#document.getRecognition #recognitionRequestを実行していればidは自動で入力されます。引数で直接指定もできます。
|
|
78
|
-
###文章画像認識取消
|
|
79
|
-
#document.cancelRecognition #recognitionRequestを実行していればidは自動で入力されます。引数で直接指定もできます。
|
|
80
|
-
###文章画像レイアウト認識要求
|
|
81
|
-
layout = Mocodo::Layout.new(api_key)
|
|
82
|
-
layout.get_layout('http://i.ytimg.com/vi/kmqAuILzS14/hqdefault.jpg')
|
|
83
|
-
|
|
84
|
-
###言語解析
|
|
85
|
-
###形態素解析
|
|
86
|
-
morph = Mocodo::Morph.new(api_key)
|
|
87
|
-
morph.configure config={
|
|
88
|
-
:request_id=>"record001",
|
|
89
|
-
:info_filter=>"form"
|
|
90
|
-
}
|
|
91
|
-
morph.morph "たおはホモ"
|
|
92
|
-
###固定表現抽出
|
|
93
|
-
entity = Mocodo::Entity.new(api_key)
|
|
94
|
-
entity.configure config={
|
|
95
|
-
:class_filter=>"ART|ORG|PSN|LOC|DAT|TIM"
|
|
96
|
-
}
|
|
97
|
-
entity.entity "ふらんはノンケ"
|
|
98
|
-
###語句類似度算出
|
|
99
|
-
similarity = Mocodo::Similarity.new(api_key)
|
|
100
|
-
similarity.similarity "のあちゃん","ゆあちゃん"
|
|
101
|
-
###ひらがな化
|
|
102
|
-
hiragana = Mocodo::Hiragana.new(api_key)
|
|
103
|
-
hiragana.configure config={
|
|
104
|
-
:output_type=>"hiragana"
|
|
105
|
-
}
|
|
106
|
-
hiragana.hiragana "Fラン私立大学"
|
|
107
|
-
|
|
108
|
-
###雑談対話
|
|
109
|
-
dialogue = Mocodo::Dialogue.new(api_key)
|
|
110
|
-
dialogue.configure config = {
|
|
111
|
-
:mode=>"dialog",
|
|
112
|
-
:context=>"1234567890",
|
|
113
|
-
}
|
|
114
|
-
dialogue.create_dialogue "こんにちは"
|
|
115
|
-
dialogue.get_current_data
|
|
116
|
-
|
|
117
|
-
###トレンド記事抽出
|
|
118
|
-
###ジャンル情報の取得
|
|
119
|
-
genre = Mocodo::Genre.new(api_key)
|
|
120
|
-
genre.get_genre
|
|
121
|
-
###記事取得
|
|
122
|
-
contents = Mocodo::Contents.new(api_key)
|
|
123
|
-
contents.get_contents config={
|
|
124
|
-
:genreId=>"1",
|
|
125
|
-
}
|
|
126
|
-
###キーワード検索
|
|
127
|
-
search = Mocodo::Search.new(api_key)
|
|
128
|
-
search.search_contents config={
|
|
129
|
-
:keyword=>"ラーメン"
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
###知識Q&A
|
|
133
|
-
qa = Mocodo::KnowledgeQA.new(api_key)
|
|
134
|
-
qa.create_qa "今日は何日"
|