Metadata-Version: 2.4
Name: ovos-utterance-plugin-cancel
Version: 0.2.9a1
Summary: OpenVoiceOS Utterance Cancel Plugin
Author-email: OpenVoiceOS <openvoiceos@gmail.com>
License: Apache-2.0
Project-URL: Homepage, https://github.com/OpenVoiceOS/ovos-utterance-plugin-cancel
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Text Processing :: Linguistic
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: ovos-utils<1.0.0,>=0.11.1a1
Requires-Dist: ovos-plugin-manager>=0.0.1
Requires-Dist: ovos-spec-tools[langcodes]<1.0.0,>=0.5.1a1
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Provides-Extra: test
Requires-Dist: ovoscope; extra == "test"
Requires-Dist: ovos-skill-hello-world; extra == "test"
Dynamic: license-file

# ovos-utterance-plugin-cancel

[![PyPI](https://img.shields.io/pypi/v/ovos-utterance-plugin-cancel)](https://pypi.org/project/ovos-utterance-plugin-cancel/)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)

An [OpenVoiceOS](https://openvoiceos.org) utterance transformer plugin that cancels an utterance when the user says a cancel/nevermind phrase at the end.

**Example:** *"Hey Mycroft, can you tell me the weather in… ugh, nevermind that"* → utterance is dropped, no skill fires.

## Installation

```bash
pip install ovos-utterance-plugin-cancel
```

## How it works

The plugin runs before skill matching. It checks whether the utterance tail matches any phrase from `locale/<lang>/cancel.intent`. On a match, it returns an empty utterance list with context `{"canceled": True, "cancel_word": "<phrase>"}`.

Language selection is automatic via `langcodes.closest_match`. Phrases support bracket-expansion syntax (e.g. `cancel (it|that)`).

## Supported languages

`ca-ES` · `da-DK` · `de-DE` · `en-US` · `es-ES` · `fr-FR` · `gl-ES` · `it-IT` · `nl-NL` · `pt-BR` · `pt-PT`

To add a language, create `ovos_utterance_plugin_cancel/locale/<lang>/cancel.intent` with one phrase per line.

## Configuration

This plugin is **enabled by default** in `ovos-config` alongside the other standard utterance transformers:

```json
"utterance_transformers": {
    "ovos-utterance-normalizer": {},
    "ovos-utterance-plugin-cancel": {},
    "ovos-utterance-corrections-plugin": {}
}
```

To disable it, add `"enable": false` to your config:

```json
"utterance_transformers": {
    "ovos-utterance-plugin-cancel": {"enable": false}
}
```

## Development

```bash
git clone https://github.com/OpenVoiceOS/ovos-utterance-plugin-cancel
cd ovos-utterance-plugin-cancel
uv pip install -e ".[dev]"
uv run pytest test/ -v --cov=ovos_utterance_plugin_cancel
```

## Credits

- [@penrods](https://github.com/MycroftAI/mycroft-core/pull/1274) — original Mycroft PR
- [NeonGecko](https://github.com/NeonGeckoCom/neon-utterance-plugin-cancel) — original plugin
