Package: rasa-nlu
Rasa NLURasa NLU (Natural Language Understanding) is a tool for understanding what is being said in short pieces of text.
For example, taking a short message like:"I'm looking for a Mexican restaurant in the center of town"And returning structured data like:intent: search_restaurant
  entities: 
    - cuisine : Mexican
    - location : centerRasa NLU is primarily used to build chatbots and voice apps, where this is called intent classification and entity extraction.
To use Rasa,you have to provide some training data.
That is, a set of messages which you've already labelled with their intents and entities.
Rasa then uses machine learning to pick up patterns and generalise to unseen sentences.You can think of Rasa NLU as a set of high level APIs for building your own language parser using existing NLP and ML libraries.If you are new to Rasa NLU and want to create a bot, you should start with thetutorial.What does Rasa NLU do? 🤔Read About the Rasa StackI'd like to read the detailed docs 🤓Read The DocsI'm ready to install Rasa NLU! 🚀InstallationI have a question ❓Rasa Community ForumI would like to contribute 🤗How to contributeImportant NoteCurrent github master version does NOT support python 2.7 anymore (neither
will the next major release). If you want to use Rasa NLU with python
2.7, please install the most recent version from pypi (0.14).Quick InstallFor the full installation instructions, please head over to the documentation:InstallationVia Docker ImageFrom docker hub:docker run -p 5000:5000 rasa/rasa_nlu:latest-full(for more docker installation options seeAdvanced Docker Installation)Via Python LibraryFrom pypi:pip install rasa_nlu
python -m rasa_nlu.server &(for more python installation options seeAdvanced Python Installation)Basic testThe below command can be executed for either method used above.curl 'http://localhost:5000/parse?q=hello'Example useGet the Server Statuscurl 'http://localhost:5000/status'Check the Server Versioncurl 'http://localhost:5000/version'Training New ModelsExamplesandDocumentationof the training data
format are provided. But as a quick start execute the below command to train
a new modelJson formatcurl 'https://raw.githubusercontent.com/RasaHQ/rasa_nlu/master/sample_configs/config_train_server_json.yml' | \
curl --request POST --header 'content-type: application/x-yml' --data-binary @- --url 'localhost:5000/train?project=test_model'This will train a simple keyword based models (not usable for anything but this demo). For better
pipelines consult the documentation.Markdown formatwget 'https://raw.githubusercontent.com/RasaHQ/rasa_nlu/master/sample_configs/config_train_server_md.yml'
curl --request POST --header 'content-type: application/x-yml' --data-binary @config_train_server_md.yml --url 'localhost:5000/train?project=test_model'The above command does the following:It Fetches some of the example data in the repoItPOSTSthat data to the/trainendpoint and names the modelproject=test_modelParsing New RequestsMake sure the above command has finished before executing the below. You can check with the/statuscommand above.curl 'http://localhost:5000/parse?q=hello&project=test_model'FAQWho is it for?The intended audience is mainlypeople developing bots, starting from scratch or looking to find a a drop-in replacement forwit,LUIS, orDialogflow. The setup process is designed to be as simple as possible. Rasa NLU is written in Python, but you can use it from any language through aHTTP API. If your project is written in Python you cansimply import the relevant classes. If you're currently using wit/LUIS/Dialogflow, you just:Download your app data from wit, LUIS, or Dialogflow and feed it into Rasa NLURun Rasa NLU on your machine and switch the URL of your wit/LUIS api calls tolocalhost:5000/parse.Why should I use Rasa NLU?You don't have to hand over your data to FB/MSFT/GOOGYou don't have to make ahttpscall to parse every message.You can tune models to work well on your particular use case.These points are laid out in more detail in ablog post.
Rasa is a set of tools for building more advanced bots, developed by
the companyRasa. Rasa NLU is the natural language
understanding module, and the first component to be open-sourced.What languages does it support?Thesupervised_embeddingspipeline works in any language.
If you want to use pre-trained word embeddings, there are models available for
many languages. See detailshereHow to contributeWe are very happy to receive and merge your contributions. There is some more information about the style of the code and docs in thedocumentation.In general the process is rather simple:create an issue describing the feature you want to work on (or have a look at issues with the labelhelp wanted)write your code, tests and documentationcreate a pull request describing your changesYou pull request will be reviewed by a maintainer, who might get back to you about any necessary changes or questions. You will also be asked to sign theContributor License AgreementAdvanced installationAdvanced PythonFrom github:git clone git@github.com:RasaHQ/rasa_nlu.git
cd rasa_nlu
pip install -r requirements.txt
pip install -e .For local development make sure you install the development requirements:pip install -r alt_requirements/requirements_dev.txt
pip install -e .To test the installation use (this will run a very stupid default model. you need totrain your own modelto do something useful!):Advanced DockerBefore you start, ensure you have the latest version of docker engine on your machine. You can check if you have docker installed by typingdocker -vin your terminal.To see all available builds go to theRasa docker hub, but to get up and going the quickest just run:docker run -p 5000:5000 rasa/rasa_nlu:latest-fullThere are also three volumes, which you may want to map:/app/projects,/app/logs, and/app/data. It is also possible to override the config file used by the server by mapping a new config file to the volume/app/config.json. For complete docker usage instructions go to the officialdocker hub readme.To test run the below command after the container has started. For more info on using the HTTP API seeherecurl 'http://localhost:5000/parse?q=hello'Docker CloudWarning! setting up Docker Cloud is quite involved - this method isn't recommended unless you've already configured Docker Cloud Nodes (or swarms)Install Pretrained Models for Spacy & MitieIn order to use the Spacy or Mitie backends make sure you have one of their pretrained models installed.python -m spacy download enTo download the Mitie model run and place it in a location that you can
reference in your configuration during model training:wget https://github.com/mit-nlp/MITIE/releases/download/v0.4/MITIE-models-v0.2.tar.bz2
tar jxf MITIE-models-v0.2.tar.bz2If you want to run the tests, you need to copy the model into the Rasa folder:cp MITIE-models/english/total_word_feature_extractor.dat RASA_NLU_ROOT/data/WhereRASA_NLU_ROOTpoints to your Rasa installation directory.Development InternalsSteps to release a new versionReleasing a new version is quite simple, as the packages are build and distributed by travis. The following things need to be done to release a new versionupdaterasa_nlu/version.pyto reflect the correct version numberedit theCHANGELOG.rst, create a new section for the release (eg by moving the items from the collected master section) and create a new master logging sectionedit themigration guideto provide assistance for users updating to the new versioncommit all the above changes and tag a new release, e.g. usinggit tag -f 0.7.0 -m "Some helpful line describing the release"
git push origin 0.7.0travis will build this tag and push a package topypionly if it is amajor release, a new branch should be created pointing to the same commit as the tag to allow for future minor patches, e.g.git checkout -b 0.7.x
git push origin 0.7.xRunning the TestsIn order to run the tests make sure that you have the development requirements installed.make testLicenseLicensed under the Apache License, Version 2.0. Copyright 2019
Rasa Technologies GmbH.Copy of the license.A list of the Licenses of the dependencies of the project can be found at
the bottom of theLibraries Summary.