This gem provides an adapter to Wit.AI service. Wit.AI is an free natural language processing which can be used to determine user intents in natural language.
Add this line to your charyf application's Gemfile:
gem 'witai-charyf'
And then execute:
$ bundle
Then add the wit.ai to the applocation loads by adding line to config/load.rb
require 'witai/charyf'
To generate the intializer run
charyf generate witai:install
You should be welcomed by the message
create config/initializers/wit.rb
notice Wit installed
Do not forget to set wit intent processor in application configuration
config.enabled_intent_processors = [.., :wit, ..]
You can configure the processor inside config/initializers/wit.rb
which was generated by the installer
Now enable wit.ai processor inside your application config (config/application.rb
) or specific environment config (e.g.: config/environments/development.rb
)
config.enabled_intent_processors = [.., :wit, ..]
You can add wit as intent processor during generation of new application. Just use
--intent-processors=wit
as argument with your charyf new ...
command.
When installing wit along charyf new application, config/loads.rb
and configuration inside config/application.rb
will be populated automatically.
You can configure the processor inside config/initializers/wit.rb
which was generated by the installer
WitAI::Charyf::Extension.configure do
# Set to you Wit.AI App API Key
# As charyf uses wit only to determine intent you can use
# either server or client key
#
# config.api_key = 'PUMSOASDDB43HCJ3OMBOXKEENOOS92WDI6' <- your API key
end
See https://wit.ai/docs/quickstart gudie to learn how to define intents using wit.
Don't forget to wait for training to finish.
Intent names are then routed inside charyf. If you define intent value some_intent then you can route this intent name inside charyf's router.
Define routing as usually using config/routes.rb
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the Wit::Nlp::Charyf project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.