首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

Snips NLU:一个语义解析的开源python库

https://github.com/snipsco/snips-nlu

https://snips-nlu.readthedocs.io/en/latest/quickstart.html

这个库是用来解析一个问题,识别问的是啥问题,以及这个问题的各个要素

比如:

这个问题问出来,机器要自动能识别出来:

问题的倾向:天气预报

天气预报的时间:9pm

天气预报的地点:paris

这个问题有很广泛的应用:

语音助手:请帮我打开电灯 => 倾向:打开,打开的对象:电灯

自动订票:请帮我订明天去北京的机票=>倾向:订票,航班的时间:明天,航班的目的地:北京

What is Snips NLU about ?

Behind every chatbot and voice assistant lies a common piece of technology: Natural Language Understanding (NLU). Anytime a user interacts with an AI using natural language, their words need to be translated into a machine-readable description of what they meant.

The NLU engine first detects what the intention of the user is (a.k.a. intent), then extracts the parameters (called slots) of the query. The developer can then use this to determine the appropriate action or response.

Let’s take an example to illustrate this, 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 this case, the identified intent is searchWeatherForecast and two slots were extracted, a locality and a datetime. As you can see, Snips NLU does an extra step on top of extracting entities: it resolves them. The extracted datetime value has indeed been converted into a handy ISO format.

  • 发表于:
  • 原文链接https://kuaibao.qq.com/s/20181126G0R8L700?refer=cp_1026
  • 腾讯「腾讯云开发者社区」是腾讯内容开放平台帐号(企鹅号)传播渠道之一,根据《腾讯内容开放平台服务协议》转载发布内容。
  • 如有侵权,请联系 cloudcommunity@tencent.com 删除。

扫码

添加站长 进交流群

领取专属 10元无门槛券

私享最新 技术干货

扫码加入开发者社群
领券