Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ovos-solver-yes-no-plugin-0.0.0a2.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file ovos-solver-yes-no-plugin-0.0.0a2.tar.gz.

File metadata

File hashes

Hashes for ovos-solver-yes-no-plugin-0.0.0a2.tar.gz
Algorithm Hash digest
SHA256 fc5c5598975fbc7fd9b385735306ab395285f23e50d64fdab1aa8a4c58b62e0d
MD5 20b8854cf7a0cf10e6ee7c1d7aa3977c
BLAKE2b-256 f8486eed933f5778366c3bc2ec2a85a0beb2a29d4c1d171e34a86a2d659c97b4

See more details on using hashes here.

File details

Details for the file ovos_solver_yes_no_plugin-0.0.0a2-py3-none-any.whl.

File metadata

File hashes

Hashes for ovos_solver_yes_no_plugin-0.0.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 db1b433c009fc316a7514c188ccb735a121862ac7fae880a72829e51b2956e01
MD5 d40a1f70246c4c7e1afb9f91c8ee98e9
BLAKE2b-256 3cf06d317c14436f0ec344ff7ba8e8da0ab8793f7ef635217479b36c9b9997a8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page