This Rust crate provides APIs to extract entities in the context of a Natural Language Understanding (NLU) task.
A Python wrapper is also available.
Add this to your Cargo.toml
:
[dependencies]
snips-nlu-parsers = { git = "https://github.com/snipsco/snips-nlu-parsers", tag = "0.1.0" }
use snips_nlu_parsers::{BuiltinEntityKind, BuiltinEntityParserLoader, Language};
fn parse_entities() {
let parser = BuiltinEntityParserLoader::new(Language::EN).load().unwrap();
let entities: Vec<(_, _)> = parser
.extract_entities("Book me restaurant for two people tomorrow", None)
.unwrap()
.into_iter()
.map(|e| (e.entity_kind, e.range))
.collect();
assert_eq!(
vec![
(BuiltinEntityKind::Number, 23..26),
(BuiltinEntityKind::Time, 34..42)
],
entities
);
}
- Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT) or http://opensource.org/licenses/MIT)
at your option.
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.