luis 0.1.0.pre.alpha → 0.1.0.pre.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -5
- data/lib/luis/action.rb +9 -0
- data/lib/luis/{response.rb → base.rb} +1 -6
- data/lib/luis/dialog.rb +13 -0
- data/lib/luis/entity.rb +5 -0
- data/lib/luis/intent.rb +9 -0
- data/lib/luis/parameter.rb +5 -0
- data/lib/luis/result.rb +27 -0
- data/lib/luis/version.rb +1 -1
- data/lib/luis.rb +11 -4
- metadata +6 -4
- data/lib/luis/action_parameter.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20b89c0201f2815959c4bc71542c32504ff338fe
|
4
|
+
data.tar.gz: 8e32841762775a9c9f282524a36e301e9efa4da8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31332d6ef01a60e03a9d84b87e211266723d58379bf700dddd3a509e3c43a307506ca4243704976eb56554c8f884ec09f3a519ad1fd7efc0bf1e77d11f91ed51
|
7
|
+
data.tar.gz: ed93283d7e347d373881e1f493b126b73875300a9e70d3cd7bfe970463b5a23c031fbe068846d68998cfc972ca1cfb7188feefc0d2585de519f6078e6d7232c3
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# Luis
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
Microsoft Language Understanding Intelligent Service (LUIS) Ruby client
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -22,8 +20,16 @@ Or install it yourself as:
|
|
22
20
|
|
23
21
|
## Usage
|
24
22
|
|
25
|
-
|
23
|
+
```ruby
|
24
|
+
Luis.configure do |config|
|
25
|
+
config.id = "<id>"
|
26
|
+
config.subscription_key ="<key>"
|
27
|
+
end
|
28
|
+
```
|
26
29
|
|
30
|
+
```ruby
|
31
|
+
Luis.query("Book flight to Banagalore")
|
32
|
+
```
|
27
33
|
## Development
|
28
34
|
|
29
35
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -32,7 +38,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
38
|
|
33
39
|
## Contributing
|
34
40
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
41
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/tachyons/luis. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
42
|
|
37
43
|
|
38
44
|
## License
|
data/lib/luis/action.rb
CHANGED
@@ -1,14 +1,9 @@
|
|
1
1
|
module Luis
|
2
|
-
class
|
3
|
-
attr_accessor :query, :intents, :entities, :dialog
|
2
|
+
class Base
|
4
3
|
def initialize(options = {})
|
5
4
|
options.each do |key, value|
|
6
5
|
instance_variable_set("@#{key}", value)
|
7
6
|
end
|
8
7
|
end
|
9
|
-
|
10
|
-
def intent
|
11
|
-
intents.first
|
12
|
-
end
|
13
8
|
end
|
14
9
|
end
|
data/lib/luis/dialog.rb
CHANGED
data/lib/luis/entity.rb
CHANGED
data/lib/luis/intent.rb
ADDED
data/lib/luis/result.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
module Luis
|
2
|
+
class Result < Base
|
3
|
+
attr_accessor :query, :intents, :entities, :dialog, :top_scoring_indent
|
4
|
+
|
5
|
+
def top_scoring_intent
|
6
|
+
@topScoringIndent ||= @intents.first
|
7
|
+
end
|
8
|
+
|
9
|
+
def intents
|
10
|
+
(@intents ||= [@topScoringIntent]).map do |intent|
|
11
|
+
Intent.new intent
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def dialog
|
16
|
+
Dialog.new @dialog
|
17
|
+
end
|
18
|
+
|
19
|
+
def entities
|
20
|
+
@entities.map { |entity| Entity.new entity }
|
21
|
+
end
|
22
|
+
|
23
|
+
def awaiting_dialog_response?
|
24
|
+
dialog && (dialog['status'] == 'Question')
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/luis/version.rb
CHANGED
data/lib/luis.rb
CHANGED
@@ -1,19 +1,26 @@
|
|
1
1
|
require 'luis/version'
|
2
|
-
require 'luis/response'
|
3
2
|
require 'httparty'
|
4
3
|
module Luis
|
4
|
+
autoload :Base, 'luis/base'
|
5
|
+
autoload :Result, 'luis/result'
|
6
|
+
autoload :Intent, 'luis/intent'
|
7
|
+
autoload :Action, 'luis/action'
|
8
|
+
autoload :Parameter, 'luis/parameter'
|
9
|
+
autoload :Dialog, 'luis/dialog'
|
10
|
+
autoload :Entity, 'luis/entity'
|
11
|
+
|
5
12
|
include HTTParty
|
6
13
|
class << self
|
7
14
|
attr_accessor :id, :subscription_key
|
8
15
|
end
|
9
|
-
API_URL = 'https://api.projectoxford.ai/luis/v1/application'.freeze
|
16
|
+
API_URL = 'https://api.projectoxford.ai/luis/v1/application/preview'.freeze
|
10
17
|
|
11
18
|
def self.query(query)
|
12
19
|
response = get(API_URL, query: { 'id' => id, 'subscription-key' => subscription_key, 'q' => query })
|
13
|
-
|
20
|
+
Result.new JSON.parse(response.body)
|
14
21
|
end
|
15
22
|
|
16
|
-
def self.configure(
|
23
|
+
def self.configure(options = {})
|
17
24
|
options.each do |key, value|
|
18
25
|
instance_variable_set("@#{key}", value)
|
19
26
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: luis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.pre.
|
4
|
+
version: 0.1.0.pre.alpha1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aboobacker MK
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -85,12 +85,14 @@ files:
|
|
85
85
|
- bin/setup
|
86
86
|
- lib/luis.rb
|
87
87
|
- lib/luis/action.rb
|
88
|
-
- lib/luis/
|
88
|
+
- lib/luis/base.rb
|
89
89
|
- lib/luis/combosite_entity_child.rb
|
90
90
|
- lib/luis/composite_entity.rb
|
91
91
|
- lib/luis/dialog.rb
|
92
92
|
- lib/luis/entity.rb
|
93
|
-
- lib/luis/
|
93
|
+
- lib/luis/intent.rb
|
94
|
+
- lib/luis/parameter.rb
|
95
|
+
- lib/luis/result.rb
|
94
96
|
- lib/luis/version.rb
|
95
97
|
- luis.gemspec
|
96
98
|
homepage: http://github.com/tachyons/luis
|
File without changes
|