Skip to main content
https://travis-ci.org/snipsco/snips-nlu.svg?branch=develop https://img.shields.io/pypi/v/snips-nlu.svg?branch=develop https://img.shields.io/pypi/pyversions/snips-nlu.svg?branch=develop https://codecov.io/gh/snipsco/snips-nlu/branch/develop/graph/badge.svg

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.

Installation

pip install snips-nlu

We currently have pre-built binaries (wheels) for snips-nlu and its dependencies for MacOS and Linux x86_64. If you use a different architecture/os you will need to build these dependencies from sources which means you will need to install setuptools_rust and Rust before running the pip install snips-nlu command.

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 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 io.open("sample_dataset.json") as f:
    sample_dataset = json.load(f)

load_resources("en")
nlu_engine = SnipsNLUEngine(config=CONFIG_EN)
nlu_engine.fit(sample_dataset)

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.

Documentation

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.

FAQ

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

How do I contribute ?

Please see the Contribution Guidelines.

Licence

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

Metadata

Release files for snips-nlu 0.13.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for snips-nlu 0.13.3
File Size Uploaded
snips_nlu-0.13.3.tar.gz 8.2 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for snips-nlu 0.13.3
File Interpreter ABI Platform
snips_nlu-0.13.3-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 16.5 MB

Release files / snips_nlu-0.13.3.tar.gz

Download URL snips_nlu-0.13.3.tar.gz
Size 8.2 MB
Tags Source
SHA-256 checksum
How to use checksums
f8fad05e02116e10d0a44f67a2299451840c44be9f53a65ce8a78ba2bbb0ea9a
BLAKE2b-256 checksum
How to use checksums
abbe0f670b93556e5a520e995c848fdcde71005d9365d883fb548a4072ebd783
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / snips_nlu-0.13.3-py2.py3-none-any.whl

Download URL snips_nlu-0.13.3-py2.py3-none-any.whl
Size 8.3 MB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
31511d29c416c5d8edf15583d86b22957b6d5e9a9a3f090738e1173b4b6a6a03
BLAKE2b-256 checksum
How to use checksums
46f11b7753eddd986ee23915a75522d84857c8bc16b5e497506adbf0cb91d6fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page