Skip to main content

Snips Natural Language Understanding library

Project description

Snips NLU (Natural Language Understanding) is a Python library that allows to parse sentences written in natural language and extracts structured information.

Check out our blog post to get more details about why we built Snips NLU and how it works under the hood.


pip install snips-nlu

We currently have pre-built binaries (wheels) for snips-nlu and its dependencies for MacOS (10.11 and later), Linux x86_64 and Windows.

For any other architecture/os snips-nlu can be installed from the source distribution. To do so, Rust and setuptools_rust must be installed before running the pip install snips-nlu command.

Language resources

Snips NLU relies on language resources that must be downloaded before the library can be used. You can fetch resources for a specific language by running the following command:

python -m snips_nlu download en

Or simply:

snips-nlu download en

Once the resources have been fetched, they can be loaded in Python using:

from snips_nlu import load_resources


The list of supported languages is available here.

A simple example

Let’s take an example to illustrate the main purpose of this lib, and consider the following sentence:

"What will be the weather in paris at 9pm?"

Properly trained, the Snips NLU engine will be able to extract structured data such as:

   "intent": {
      "intentName": "searchWeatherForecast",
      "probability": 0.95
   "slots": [
         "value": "paris",
         "entity": "locality",
         "slotName": "forecast_locality"
         "value": {
            "kind": "InstantTime",
            "value": "2018-02-08 20:00:00 +00:00"
         "entity": "snips/datetime",
         "slotName": "forecast_start_datetime"

Sample code

Here is a sample code that you can run on your machine after having installed snips-nlu, fetched the english resources and downloaded this sample dataset:

from __future__ import unicode_literals, print_function

import io
import json

from snips_nlu import SnipsNLUEngine, load_resources
from snips_nlu.default_configs import CONFIG_EN

with"sample_dataset.json") as f:
    sample_dataset = json.load(f)

nlu_engine = SnipsNLUEngine(config=CONFIG_EN)

text = "What will be the weather in San Francisco next week?"
parsing = nlu_engine.parse(text)
print(json.dumps(parsing, indent=2))

What it does is training an NLU engine on a sample weather dataset and parsing a weather query.


To find out how to use Snips NLU please refer to our documentation, it will provide you with a step-by-step guide on how to use and setup our library.


Please join our Discord channel to ask your questions and get feedback from the community.

How do I contribute ?

Please see the Contribution Guidelines.


This library is provided by Snips as Open Source software. See LICENSE for more information.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for snips-nlu, version 0.16.0
Filename, size File type Python version Upload date Hashes
Filename, size snips_nlu-0.16.0-py2.py3-none-any.whl (86.2 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes
Filename, size snips_nlu-0.16.0.tar.gz (60.9 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page