NluTools
Useful NLU Tools to import training data into AWS Lex, Google Dialogflow and run tests
Installation
To install:
$ gem install nlu_tools
Usage
get help
$ 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
setup keys
$ 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'
importing training data
$ nlu_toolset import lex -f ./data/simple_train.json --botname testbot
$ nlu_toolset import dialogflow -f ./data/simple_train.json -p google-project-id
running tests
$ 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
creating training & test data
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.
get all intents and its examples except the last 2 for training:
$ jq '{"training_data": [.intents[] | {"intent":.intent, "utterences":[.examples[].text] | .[:-2]}]}' data/bank_simple_workspace.json > ./data/simple_train.json
get the last 2 intents and its examples for testing:
$ jq '{"testing_data": [.intents[] | {"intent":.intent, "utterences":[.examples[].text] | .[-2:]}]}' data/bank_simple_workspace.json > ./data/simple_test.json
Development
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.
Contributing
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.
License
The gem is available as open source under the terms of the MIT License.
Code of Conduct
Everyone interacting in the NluTools project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.