ovos-adapt-parser


Nameovos-adapt-parser JSON
Version 1.0.4 PyPI version JSON
download
home_pagehttps://github.com/OpenVoiceOS/ovos-adapt-pipeline-plugin
SummaryA text-to-intent parsing framework.
upload_time2024-11-01 19:58:17
maintainerNone
docs_urlNone
authorSean Fitzgerald
requires_pythonNone
licenseApache License 2.0
keywords natural language processing
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE.md) 

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.

This repository contains a OVOS pipeline plugin and bundles a fork of the original [adapt-parser](https://github.com/MycroftAI/adapt) from the defunct MycroftAI

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)
```


Reporting Issues
================
It's often difficult to debug issues with adapt without a complete context. To facilitate simpler debugging,
please include a serialized copy of the intent determination engine using the debug dump
utilities.

```python
from ovos_adapt.engine import IntentDeterminationEngine

engine = IntentDeterminationEngine()
# Load engine with vocabulary and parsers

import ovos_adapt.tools.debug as atd

atd.dump(engine, 'debug.ovos_adapt')
```




            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/OpenVoiceOS/ovos-adapt-pipeline-plugin",
    "name": "ovos-adapt-parser",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "natural language processing",
    "author": "Sean Fitzgerald",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/7e/8e/5dba267e455973eb1589211a500ce98abdc03d407235b56fb0ea0d106a5b/ovos-adapt-parser-1.0.4.tar.gz",
    "platform": null,
    "description": "[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE.md) \n\nAdapt Intent Parser\n==================\nThe 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.\n\nThis repository contains a OVOS pipeline plugin and bundles a fork of the original [adapt-parser](https://github.com/MycroftAI/adapt) from the defunct MycroftAI\n\nExamples\n========\nExecutable examples can be found in the [examples folder](https://github.com/MycroftAI/adapt/tree/master/examples).\n\nIntent Modelling\n================\nIn this context, an Intent is an action the system should perform. In the context of Pandora, we\u2019ll define two actions: List Stations, and Select Station (aka start playback)\n\nWith the Adapt intent builder:\n```Python\nlist_stations_intent = IntentBuilder('pandora:list_stations')\\\n    .require('Browse Music Command')\\\n    .build()\n```\n\nFor the above, we are describing a \u201cList Stations\u201d intent, which has a single requirement of a \u201cBrowse Music Command\u201d entity.\n\n```Python\nplay_music_command = IntentBuilder('pandora:select_station')\\\n    .require('Listen Command')\\\n    .require('Pandora Station')\\\n    .optionally('Music Keyword')\\\n    .build()\n```\n\n\nFor the above, we are describing a \u201cSelect Station\u201d (aka start playback) intent, which requires a \u201cListen Command\u201d entity, a \u201cPandora Station\u201d, and optionally a \u201cMusic Keyword\u201d entity.\n\nEntities\n========\n\nEntities are a named value. Examples include:\n`Blink 182` is an `Artist`\n`The Big Bang Theory` is a `Television Show`\n`Play` is a `Listen Command`\n`Song(s)` is a `Music Keyword`\n\nFor 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\u2019s what the vocabulary registration looks like.\n\n```Python\ndef register_vocab(entity_type, entity_value):\n    pass\n    # a tiny bit of code \n\ndef register_pandora_vocab(emitter):\n    for v in [\"stations\"]:\n        register_vocab('Browse Music Command', v)\n\n    for v in [\"play\", \"listen\", \"hear\"]:\n        register_vocab('Listen Command', v)\n\n    for v in [\"music\", \"radio\"]:\n        register_vocab('Music Keyword', v)\n\n    for v in [\"Pandora\"]:\n        register_vocab('Plugin Name', v)\n\n    station_name_regex = re.compile(r\"(.*) Radio\")\n    p = get_pandora()\n    for station in p.stations:\n        m = station_name_regex.match(station.get('stationName'))\n        if not m:\n            continue\n        for match in m.groups():\n            register_vocab('Pandora Station', match)\n```\n\n\nReporting Issues\n================\nIt's often difficult to debug issues with adapt without a complete context. To facilitate simpler debugging,\nplease include a serialized copy of the intent determination engine using the debug dump\nutilities.\n\n```python\nfrom ovos_adapt.engine import IntentDeterminationEngine\n\nengine = IntentDeterminationEngine()\n# Load engine with vocabulary and parsers\n\nimport ovos_adapt.tools.debug as atd\n\natd.dump(engine, 'debug.ovos_adapt')\n```\n\n\n\n",
    "bugtrack_url": null,
    "license": "Apache License 2.0",
    "summary": "A text-to-intent parsing framework.",
    "version": "1.0.4",
    "project_urls": {
        "Homepage": "https://github.com/OpenVoiceOS/ovos-adapt-pipeline-plugin"
    },
    "split_keywords": [
        "natural",
        "language",
        "processing"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "91857df742803e257151a47e7107dea84e734de02e900042f7b0802648b58fbd",
                "md5": "b96abbb55c4746f0e6e3df19ad187c85",
                "sha256": "05222259bfea787eabc036318fdefbd6976d9ca67b688b77c4ab42f5f62f23ff"
            },
            "downloads": -1,
            "filename": "ovos_adapt_parser-1.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b96abbb55c4746f0e6e3df19ad187c85",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 33903,
            "upload_time": "2024-11-01T19:58:15",
            "upload_time_iso_8601": "2024-11-01T19:58:15.507679Z",
            "url": "https://files.pythonhosted.org/packages/91/85/7df742803e257151a47e7107dea84e734de02e900042f7b0802648b58fbd/ovos_adapt_parser-1.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7e8e5dba267e455973eb1589211a500ce98abdc03d407235b56fb0ea0d106a5b",
                "md5": "de0a879c8c66e2c517b18a8656b433ad",
                "sha256": "8723a0fe602c37c3ba3db8d043766c8a86813b74fc2c5f95aba1c29278a8c81e"
            },
            "downloads": -1,
            "filename": "ovos-adapt-parser-1.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "de0a879c8c66e2c517b18a8656b433ad",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 37392,
            "upload_time": "2024-11-01T19:58:17",
            "upload_time_iso_8601": "2024-11-01T19:58:17.140890Z",
            "url": "https://files.pythonhosted.org/packages/7e/8e/5dba267e455973eb1589211a500ce98abdc03d407235b56fb0ea0d106a5b/ovos-adapt-parser-1.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-01 19:58:17",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "OpenVoiceOS",
    "github_project": "ovos-adapt-pipeline-plugin",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "ovos-adapt-parser"
}
        
Elapsed time: 0.34883s