Useful NLU Tools to import training data into AWS Lex, Google Dialogflow and run tests
To install:
$ gem install nlu_tools
$ nlu_toolset help
$ nlu_toolset import help
$ nlu_toolset import help dialogflow
$ nlu_toolset import help lex
$ nlu_toolset test help
$ nlu_toolset test help lex
$ nlu_toolset test help dialogflow
$ export AWS_REGION='AWS_REGION'
$ export AWS_ACCESS_KEY_ID='AWS_ACCESS_KEY_ID'
$ export AWS_SECRET_ACCESS_KEY='AWS_SECRET_ACCESS_KEY'
$ export GOOGLE_APPLICATION_CREDENTIALS='/path/to/google-project-key.json'
$ nlu_toolset import lex -f ./data/simple_train.json --botname testbot
$ nlu_toolset import dialogflow -f ./data/simple_train.json -p google-project-id
$ nlu_toolset test lex -f ./data/simple_test.json --botname testbot -o output_l.csv -t summary
$ nlu_toolset test dialogflow -f ./data/simple_test.json -p google-project-id -o output_d.csv
The sample training and testing json files in data directory has two intents taken for simplicity from Watson Assistant Sample Application repo / bank_simple_workspace.json. It is generated using jq. Please feel free to fetch the file and run the below commands to generate the full training & test set.
$ jq '{"training_data": [.intents[] | {"intent":.intent, "utterences":[.examples[].text] | .[:-2]}]}' data/bank_simple_workspace.json > ./data/simple_train.json
$ jq '{"testing_data": [.intents[] | {"intent":.intent, "utterences":[.examples[].text] | .[-2:]}]}' data/bank_simple_workspace.json > ./data/simple_test.json
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.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/technopreneurG/nlu_tools. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the NluTools project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.