[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE.md) [![CLA](https://img.shields.io/badge/CLA%3F-Required-blue.svg)](https://mycroft.ai/cla) [![Team](https://img.shields.io/badge/Team-Mycroft_Core-violetblue.svg)](https://github.com/MycroftAI/contributors/blob/master/team/Mycroft%20Core.md) ![Status](https://img.shields.io/badge/-Production_ready-green.svg)
[![Build Status](https://travis-ci.org/MycroftAI/adapt.svg?branch=master)](https://travis-ci.org/MycroftAI/adapt) [![Coverage Status](https://coveralls.io/repos/github/MycroftAI/adapt/badge.svg?branch=dev)](https://coveralls.io/github/MycroftAI/adapt?branch=master)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](http://makeapullrequest.com)
[![Join chat](https://img.shields.io/badge/Mattermost-join_chat-brightgreen.svg)](https://chat.mycroft.ai)
Adapt Intent Parser
==================
The Adapt Intent Parser is a flexible and extensible intent definition and determination framework. It is intended to parse natural language text into a structured intent that can then be invoked programatically.
[![Introducing the Adapt Intent Parser](https://mycroft.ai/wp-content/uploads/2019/05/Adapt-video-still.png)](https://www.youtube.com/watch?v=zR9xvPtM6Ro)
Getting Started
===============
To take a dependency on Adapt, it's recommended to use virtualenv and pip to install source from github.
```bash
$ virtualenv myvirtualenv
$ . myvirtualenv/bin/activate
$ pip install -e git+https://github.com/mycroftai/adapt#egg=adapt-parser
```
Examples
========
Executable examples can be found in the [examples folder](https://github.com/MycroftAI/adapt/tree/master/examples).
Intent Modelling
================
In this context, an Intent is an action the system should perform. In the context of Pandora, we’ll define two actions: List Stations, and Select Station (aka start playback)
With the Adapt intent builder:
```Python
list_stations_intent = IntentBuilder('pandora:list_stations')\
.require('Browse Music Command')\
.build()
```
For the above, we are describing a “List Stations” intent, which has a single requirement of a “Browse Music Command” entity.
```Python
play_music_command = IntentBuilder('pandora:select_station')\
.require('Listen Command')\
.require('Pandora Station')\
.optionally('Music Keyword')\
.build()
```
For the above, we are describing a “Select Station” (aka start playback) intent, which requires a “Listen Command” entity, a “Pandora Station”, and optionally a “Music Keyword” entity.
Entities
========
Entities are a named value. Examples include:
`Blink 182` is an `Artist`
`The Big Bang Theory` is a `Television Show`
`Play` is a `Listen Command`
`Song(s)` is a `Music Keyword`
For my Pandora implementation, there is a static set of vocabulary for the Browse Music Command, Listen Command, and Music Keyword (defined by me, a native english speaker and all-around good guy). Pandora Station entities are populated via a "List Stations" API call to Pandora. Here’s what the vocabulary registration looks like.
```Python
def register_vocab(entity_type, entity_value):
pass
# a tiny bit of code
def register_pandora_vocab(emitter):
for v in ["stations"]:
register_vocab('Browse Music Command', v)
for v in ["play", "listen", "hear"]:
register_vocab('Listen Command', v)
for v in ["music", "radio"]:
register_vocab('Music Keyword', v)
for v in ["Pandora"]:
register_vocab('Plugin Name', v)
station_name_regex = re.compile(r"(.*) Radio")
p = get_pandora()
for station in p.stations:
m = station_name_regex.match(station.get('stationName'))
if not m:
continue
for match in m.groups():
register_vocab('Pandora Station', match)
```
Learn More
========
Further documentation can be found at https://adapt.mycroft.ai
PyPI 官网下载 | adapt-parser-0.3.4.tar.gz
版权申诉
76 浏览量
2022-01-08
21:14:06
上传
评论
收藏 16KB GZ 举报
挣扎的蓝藻
- 粉丝: 12w+
- 资源: 15万+
最新资源
- 基于感知器算法的线性分类程序,matlab实现 .rar
- 基于matlab实现的振动计算程序主程序 非线性振动混沌 简单易懂.rar
- 基于matlab实现的振动原理与分析计算机大作业 求解非线性振动分析,公式根据书中的 用计算方法的4阶 r-k数值方法.rar
- 基于matlab实现的整车七自由度的非线性振动
- a2.mat
- 基于人工蜂群算法,的鲁棒通信定位算法与实现MATLAB源代码.rar
- Compass-CI 基于开源软件 PR 进行自动化测试(包括构建测试,软件包自带用例测试等),构建一个开放、完整的测试系统
- typora-setup-x64(轻量级 Markdown 编辑器)
- amd 处理器 超薄本 显存大小修改软件
- 基于随机森林对酒店预订分析预测源码
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈