Skip to content

ggilley/snips-nlu-rs

 
 

Snips NLU Rust

image

Installation

Add it to your Cargo.toml:

[dependencies]
snips-nlu-lib = { git = "https://github.com/snipsco/snips-nlu-rs", branch = "master" }

Add extern crate snips_nlu_lib to your crate root and you are good to go!

Intent Parsing with Snips NLU

The purpose of the main crate of this repository, snips-nlu-lib, is to perform an information extraction task called intent parsing.

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"
      }
   ]
}

In order to achieve such a result, the NLU engine needs to be fed with a trained model (json file). This repository only contains the inference part, in order to produce trained models please check the Snips NLU python library.

API Usage

Check out the rust example to see how to use Snips. Here is how you can run the example:

git clone https://github.com/snipsco/snips-nlu-rs
cd snips-nlu-rs
git submodule update --init --recursive
cd snips-nlu-lib
cargo run --example weather examples/trained_assistant.json "What will be the weather in London tomorrow at 8am?"

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

Snips NLU rust implementation

Resources

License

Unknown and 2 other licenses found

Licenses found

Unknown
LICENSE
Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 86.3%
  • Swift 3.9%
  • Shell 3.0%
  • Kotlin 2.9%
  • Python 2.5%
  • C 1.2%
  • Objective-C 0.2%