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

Uploaded Source

Built Distribution

File details

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

File metadata

File hashes

Hashes for ovos-solver-yes-no-plugin-0.1.0a0.tar.gz
Algorithm Hash digest
SHA256 c802a64170805df5e9a3bd994b664d9314a28f1b707a28a42e1845810fc74c33
MD5 c2a79d848332d40b472f31cf112d8848
BLAKE2b-256 9b27989abd259a181bef26eba5caf66017ee51c560b579dfbe7f4e41d8cdda02

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ovos_solver_yes_no_plugin-0.1.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 2a627a99a0f6627ede29f17c6e2cc275fcecbc762a7093c9fad94e54b3cc8a55
MD5 3a0bbe5d131fb505d40a02fcfda2a77b
BLAKE2b-256 427b0b76305a6342ae95087f73e9276d6716bb61128e25f3908389ef5efd38e1

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