witai-charyf 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/README.md +30 -15
- data/lib/witai/charyf.rb +4 -0
- data/lib/witai/charyf/generators/install/install_generator.rb +27 -0
- data/lib/witai/charyf/generators/install/templates/config/initializers/wit.rb.tt +8 -0
- data/lib/witai/charyf/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21b73b62decb583d09e7ec92651ec8bb79bf2073
|
4
|
+
data.tar.gz: 98137080809ae25d5874afefb8823640da226aaa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63114f7199fb2432f0ec885060069b589cacd14f552dab3d1b0c602881677b2c772ffb2900e7bc556c40991c941566c162600d7548315537ab4c192ecae04d5c
|
7
|
+
data.tar.gz: 3b03e7e82f1136abd3fdceb70d88eb1e4b7b8efe1ad8979627d1b235f9e62355bf6ae8248c17c03749a6232c2a62c63ab07ddde4c5bbdd7d02f6c0d7147534e0
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -6,33 +6,48 @@ TODO: Delete this and the text above, and describe your gem
|
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
9
|
-
|
9
|
+
### New application
|
10
|
+
When generating new charyf app, you can install wit intent processor automatically by specifying
|
11
|
+
``charyf new [app_nane] --intent-processors=wit``
|
10
12
|
|
13
|
+
### Existing application
|
14
|
+
|
15
|
+
To install wit processor to existing charyf application
|
16
|
+
Add gem to your gemfile
|
11
17
|
```ruby
|
12
|
-
gem '
|
18
|
+
gem 'adapt-charyf', '>= 0.2.4'
|
13
19
|
```
|
14
20
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
Or install it yourself as:
|
21
|
+
Edit *enabled_intent_processors* inside *config/application.rb*
|
22
|
+
```ruby
|
23
|
+
config.enabled_intent_processors = [:wit, etc...]
|
24
|
+
```
|
20
25
|
|
21
|
-
|
26
|
+
Add the require inside inside *config/load.rb*
|
27
|
+
```ruby
|
28
|
+
require 'witai/charyf'
|
29
|
+
```
|
22
30
|
|
23
|
-
|
31
|
+
### Configure
|
24
32
|
|
25
|
-
|
33
|
+
If you dont set your api keys for wit application, the initialization will throw
|
34
|
+
``/Users/rycco/.rvm/gems/ruby-2.2.2@charyf/gems/witai-charyf-0.2.0/lib/witai/charyf/processor.rb:18:in `initialize': WitAI::Charyf.api_key has not been set (WitAI::Charyf::Processor::NoKeyProvided)``
|
26
35
|
|
27
|
-
|
36
|
+
To configure create file *config/initializers/witai.rb* and set the API key
|
37
|
+
```ruby
|
38
|
+
require 'witai/charyf'
|
28
39
|
|
29
|
-
|
40
|
+
WitAI::Charyf::Extension.configure do
|
41
|
+
config.api_key = 'SOME_CLIENT_API_KEY'
|
42
|
+
end
|
43
|
+
```
|
30
44
|
|
31
|
-
|
45
|
+
## Usage
|
32
46
|
|
33
|
-
|
47
|
+
To define intent visit http://wit.ai/ and define an intent and entities inside your application.
|
48
|
+
Don't forget to wait for training to finish.
|
34
49
|
|
35
|
-
|
50
|
+
Define routing as usually using *config/routes.rb*
|
36
51
|
|
37
52
|
## License
|
38
53
|
|
data/lib/witai/charyf.rb
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'charyf/utils/generator/base'
|
2
|
+
|
3
|
+
module WitAI
|
4
|
+
module Charyf
|
5
|
+
module Generators
|
6
|
+
class InstallGenerator < ::Charyf::Generators::Base
|
7
|
+
|
8
|
+
source_root File.expand_path('templates', __dir__)
|
9
|
+
|
10
|
+
namespace 'witai:install'
|
11
|
+
|
12
|
+
def initializer
|
13
|
+
template 'config/initializers/wit.rb.tt'
|
14
|
+
end
|
15
|
+
|
16
|
+
def finalize
|
17
|
+
return unless behavior == :invoke
|
18
|
+
|
19
|
+
say_status 'notice', "Wit installed" +
|
20
|
+
"\n\t\tDo not forget to set adapt intent processor in application configuration" +
|
21
|
+
"\n\t\t\tconfig.enabled_intent_processors = [.., :wit, ..]", :green
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
WitAI::Charyf::Extension.configure do
|
2
|
+
# Set to you Wit.AI App API Key
|
3
|
+
# As charyf uses wit only to determine intent you can use
|
4
|
+
# either server or client key
|
5
|
+
#
|
6
|
+
# config.api_key = 'PUMSOASDDB43HCJ3OMBOXKEENOOS92WDI6'
|
7
|
+
# PS: The key above is made up :)
|
8
|
+
end
|
data/lib/witai/charyf/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: witai-charyf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Ludvigh
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: charyf
|
@@ -112,6 +112,8 @@ files:
|
|
112
112
|
- bin/console
|
113
113
|
- bin/setup
|
114
114
|
- lib/witai/charyf.rb
|
115
|
+
- lib/witai/charyf/generators/install/install_generator.rb
|
116
|
+
- lib/witai/charyf/generators/install/templates/config/initializers/wit.rb.tt
|
115
117
|
- lib/witai/charyf/processor.rb
|
116
118
|
- lib/witai/charyf/version.rb
|
117
119
|
- witai-charyf.gemspec
|