GithubHelp home page GithubHelp logo

voltek62 / snips-nlu Goto Github PK

View Code? Open in Web Editor NEW

This project forked from snipsco/snips-nlu

0.0 2.0 0.0 5.83 MB

Snips Python library to extract meaning from text

Home Page: https://snips-nlu.readthedocs.io

License: Apache License 2.0

Python 100.00%

snips-nlu's Introduction

Snips NLU

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

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.

Links

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.

snips-nlu's People

Contributors

adrienball avatar choufractal avatar clemdoum avatar fredszaq avatar jdureau avatar tristandeleu avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.