ovos-solver-yes-no-plugin


Nameovos-solver-yes-no-plugin JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/OpenVoiceOS/ovos-solver-YesNo-plugin
SummaryA question solver plugin for OVOS
upload_time2024-11-07 09:59:40
maintainerNone
docs_urlNone
authorjarbasai
requires_pythonNone
licenseMIT
keywords ovos openvoiceos plugin utterance fallback query
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # YesNo solver

exposes a Yes No parser as a solver plugin

> **NOT** meant to be used within persona framework

this solver only indicates if the user answered "yes" or "no" to a yes/no prompt

> ie, it is indicated to **parse** user responses

## Install

`pip install ovos-solver-yes-no-plugin`

## Usage

Standalone usage

```python
from ovos_yes_no_solver import YesNoSolver

bot = YesNoSolver()
assert bot.spoken_answer("i agree") == "yes"
assert bot.spoken_answer("no way") == "no"
```


more examples from unittests
```python
from ovos_yes_no_solver import YesNoSolver

solver = YesNoSolver()

def test_utt(text, expected):
    res = solver.match_yes_or_no(text, "en-us")
    return res == expected

test_utt("yes", True)
test_utt("no", False)
test_utt("no way", False)
test_utt("don't think so", False)
test_utt("i think not", False)
test_utt("that's affirmative", True)
test_utt("beans", None)
test_utt("no, but actually, yes", True)
test_utt("yes, but actually, no", False)
test_utt("yes, yes, yes, but actually, no", False)
test_utt("please", True)
test_utt("please don't", False)
test_utt("I agree", True)
test_utt("agreed", True)
test_utt("I disagree", False)
test_utt("disagreed", False)

# test "neutral_yes" -> only count as yes word if there isn't a "no" in sentence
test_utt("no! please! I beg you", False)
test_utt("yes, i don't want it for sure", False)
test_utt("please! I beg you", True)
test_utt("i want it for sure", True)
test_utt("obviously", True)
test_utt("indeed", True)
test_utt("no, I obviously hate it", False)

# test "neutral_no" -> only count as no word if there isn't a "yes" in sentence
test_utt("do I hate it when companies sell my data? yes, that's certainly undesirable", True)
test_utt("that's certainly undesirable", False)
test_utt("yes, it's a lie", True)
test_utt("no, it's a lie", False)
test_utt("he is lying", False)
test_utt("correct, he is lying", True)
test_utt("it's a lie", False)
test_utt("you are mistaken", False)
test_utt("that's a mistake", False)
test_utt("wrong answer", False)

# test double negation
test_utt("it's not a lie", True)
test_utt("he is not lying", True)
test_utt("you are not mistaken", True)
test_utt("tou are not wrong", True)
```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/OpenVoiceOS/ovos-solver-YesNo-plugin",
    "name": "ovos-solver-yes-no-plugin",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "OVOS openvoiceos plugin utterance fallback query",
    "author": "jarbasai",
    "author_email": "jarbasai@mailfence.com",
    "download_url": "https://files.pythonhosted.org/packages/05/78/eb7482cf90a976bee5296f04a02c78a24d596580cc7d8dc15bba32cf58fb/ovos-solver-yes-no-plugin-0.1.0.tar.gz",
    "platform": null,
    "description": "# YesNo solver\n\nexposes a Yes No parser as a solver plugin\n\n> **NOT** meant to be used within persona framework\n\nthis solver only indicates if the user answered \"yes\" or \"no\" to a yes/no prompt\n\n> ie, it is indicated to **parse** user responses\n\n## Install\n\n`pip install ovos-solver-yes-no-plugin`\n\n## Usage\n\nStandalone usage\n\n```python\nfrom ovos_yes_no_solver import YesNoSolver\n\nbot = YesNoSolver()\nassert bot.spoken_answer(\"i agree\") == \"yes\"\nassert bot.spoken_answer(\"no way\") == \"no\"\n```\n\n\nmore examples from unittests\n```python\nfrom ovos_yes_no_solver import YesNoSolver\n\nsolver = YesNoSolver()\n\ndef test_utt(text, expected):\n    res = solver.match_yes_or_no(text, \"en-us\")\n    return res == expected\n\ntest_utt(\"yes\", True)\ntest_utt(\"no\", False)\ntest_utt(\"no way\", False)\ntest_utt(\"don't think so\", False)\ntest_utt(\"i think not\", False)\ntest_utt(\"that's affirmative\", True)\ntest_utt(\"beans\", None)\ntest_utt(\"no, but actually, yes\", True)\ntest_utt(\"yes, but actually, no\", False)\ntest_utt(\"yes, yes, yes, but actually, no\", False)\ntest_utt(\"please\", True)\ntest_utt(\"please don't\", False)\ntest_utt(\"I agree\", True)\ntest_utt(\"agreed\", True)\ntest_utt(\"I disagree\", False)\ntest_utt(\"disagreed\", False)\n\n# test \"neutral_yes\" -> only count as yes word if there isn't a \"no\" in sentence\ntest_utt(\"no! please! I beg you\", False)\ntest_utt(\"yes, i don't want it for sure\", False)\ntest_utt(\"please! I beg you\", True)\ntest_utt(\"i want it for sure\", True)\ntest_utt(\"obviously\", True)\ntest_utt(\"indeed\", True)\ntest_utt(\"no, I obviously hate it\", False)\n\n# test \"neutral_no\" -> only count as no word if there isn't a \"yes\" in sentence\ntest_utt(\"do I hate it when companies sell my data? yes, that's certainly undesirable\", True)\ntest_utt(\"that's certainly undesirable\", False)\ntest_utt(\"yes, it's a lie\", True)\ntest_utt(\"no, it's a lie\", False)\ntest_utt(\"he is lying\", False)\ntest_utt(\"correct, he is lying\", True)\ntest_utt(\"it's a lie\", False)\ntest_utt(\"you are mistaken\", False)\ntest_utt(\"that's a mistake\", False)\ntest_utt(\"wrong answer\", False)\n\n# test double negation\ntest_utt(\"it's not a lie\", True)\ntest_utt(\"he is not lying\", True)\ntest_utt(\"you are not mistaken\", True)\ntest_utt(\"tou are not wrong\", True)\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A question solver plugin for OVOS",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/OpenVoiceOS/ovos-solver-YesNo-plugin"
    },
    "split_keywords": [
        "ovos",
        "openvoiceos",
        "plugin",
        "utterance",
        "fallback",
        "query"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5cd814d4b08e65f97a91adccd1a2b9d7309fdf874bfd988d9b7e2f7444a9fa1a",
                "md5": "072f0d1f50fe02f4112ff3a919e34dd0",
                "sha256": "2bbf256f2281df1c85b5710f36b01fa0a0de63a3224fec9c710b203e612c4415"
            },
            "downloads": -1,
            "filename": "ovos_solver_yes_no_plugin-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "072f0d1f50fe02f4112ff3a919e34dd0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 4448,
            "upload_time": "2024-11-07T09:59:38",
            "upload_time_iso_8601": "2024-11-07T09:59:38.990763Z",
            "url": "https://files.pythonhosted.org/packages/5c/d8/14d4b08e65f97a91adccd1a2b9d7309fdf874bfd988d9b7e2f7444a9fa1a/ovos_solver_yes_no_plugin-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0578eb7482cf90a976bee5296f04a02c78a24d596580cc7d8dc15bba32cf58fb",
                "md5": "ca7222b84c8b82f05d2e2e6015b5459b",
                "sha256": "0258b8e3770d817c233a70781976f1d8d7b27805234a20045f76a39f90e4e40f"
            },
            "downloads": -1,
            "filename": "ovos-solver-yes-no-plugin-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "ca7222b84c8b82f05d2e2e6015b5459b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4273,
            "upload_time": "2024-11-07T09:59:40",
            "upload_time_iso_8601": "2024-11-07T09:59:40.475438Z",
            "url": "https://files.pythonhosted.org/packages/05/78/eb7482cf90a976bee5296f04a02c78a24d596580cc7d8dc15bba32cf58fb/ovos-solver-yes-no-plugin-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-07 09:59:40",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "OpenVoiceOS",
    "github_project": "ovos-solver-YesNo-plugin",
    "github_not_found": true,
    "lcname": "ovos-solver-yes-no-plugin"
}
        
Elapsed time: 0.41257s