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

Uploaded Source

Built Distribution

File details

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

File metadata

File hashes

Hashes for ovos-solver-yes-no-plugin-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0258b8e3770d817c233a70781976f1d8d7b27805234a20045f76a39f90e4e40f
MD5 ca7222b84c8b82f05d2e2e6015b5459b
BLAKE2b-256 0578eb7482cf90a976bee5296f04a02c78a24d596580cc7d8dc15bba32cf58fb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ovos_solver_yes_no_plugin-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2bbf256f2281df1c85b5710f36b01fa0a0de63a3224fec9c710b203e612c4415
MD5 072f0d1f50fe02f4112ff3a919e34dd0
BLAKE2b-256 5cd814d4b08e65f97a91adccd1a2b9d7309fdf874bfd988d9b7e2f7444a9fa1a

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