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.0a0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

File details

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

File metadata

File hashes

Hashes for ovos-solver-yes-no-plugin-0.0.0a0.tar.gz
Algorithm Hash digest
SHA256 7ac7731b9114d35c90d694e4f7c5a6b006888c3dc45f490cf6ec9573e384b31a
MD5 20ff5fc1e08e73b5166ffce3d51b2e45
BLAKE2b-256 4ebec4a38d8f1b68a502f16311b199b96486d183db39b6913fda151dfd7fe1c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ovos_solver_yes_no_plugin-0.0.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 ce16f8f421bd2527a8ec29d4a64d423b20c0b2128ca5330a1850e8b23117c675
MD5 a903c2102fec757d6ff6a3d00ae16445
BLAKE2b-256 f227f97b7d78c7cef0a6a3e27a7182d785652fbacb7f761627c240746dbc940d

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