A question solver plugin for OVOS
Project description
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
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
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)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ovos-solver-yes-no-plugin-0.1.0a1.tar.gz
.
File metadata
- Download URL: ovos-solver-yes-no-plugin-0.1.0a1.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4fb3215156a5472addf6b8132d9c16c05d0d85f1a92ef6555662151c62f6f969 |
|
MD5 | 5209b3860adbc86caae767ba06d216f0 |
|
BLAKE2b-256 | ad38be77a89e9352d9342316e6df71ce3ffdc887696f90e63491ce7440c67b6d |
File details
Details for the file ovos_solver_yes_no_plugin-0.1.0a1-py3-none-any.whl
.
File metadata
- Download URL: ovos_solver_yes_no_plugin-0.1.0a1-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5083db3630e4b380f3930d99cb14c1e51847b7ddcf37c5138debe9ecdfb0a78a |
|
MD5 | ce98383ad5da1b4664e3a5c649be5fa3 |
|
BLAKE2b-256 | 4a1b54bf8c4f4f0e0c16d7fa821ac36dc8a0d8e8b0d6d84a50fd790fbda2fde0 |