Skip to main content

Boolean question-answer prediction with AI

Project description

Boolean Question

PyPI Hits CodeFactor Downloads

Get accurate answer prediction for True / False question using this python pytorch model. The model takes a passage and question as input and returns either "True" or "False" as predicted answer. Model used is RoBERTa that is further trained on BoolQ dataset.

Installation

Install it with python package installer pip

pip install boolean_question

or install the latest master branch

pip install git+https://github.com/Saadmairaj/boolean-question

Usage

The usage is simple and straight forward, import BoolQ class model and pass arguments to the BoolQ.predict(passage: str, question: str) method to predict the boolean answer "True" or "False"

import pprint
from boolean_question import BoolQ

bq = BoolQ()

passage = """
A red dwarf is the smallest and coolest kind of star on the main sequence.
Red dwarfs are by far the most common type of star in the Milky Way, at
least in the neighborhood of the Sun, but because of their low luminosity,
individual red dwarfs cannot be easily observed."""

question = "Coolest star in the Milky way is a Red dwarf"

# Predict the answer from the passage and the question
ans = bq.predict(passage, question)
print(ans)

# After prediction extra details of the prediction can be seen with the below command
pprint.pprint(bq.prediction_details())
View output

True
{'answer': True,
'confidence': None,
'false confidence': 0.01,
'passage': '\n'
            'A red dwarf is the smallest and coolest kind of star on the main '
            'sequence. Red dwarfs are by far the most common type of star in \n'
            'the Milky Way, at least in the neighborhood of the Sun, but '
            'because of their low luminosity, individual red dwarfs cannot '
            'be \n'
            'easily observed.',
'question': 'Coolest star in the Milky way is a Red dwarf',
'true confidence': 0.99}

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

boolean_question-0.0.3.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

boolean_question-0.0.3-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file boolean_question-0.0.3.tar.gz.

File metadata

  • Download URL: boolean_question-0.0.3.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.13

File hashes

Hashes for boolean_question-0.0.3.tar.gz
Algorithm Hash digest
SHA256 667b2d289c7bb4726a5040f6d12305b18b36e0c05d7b462edf94ce6f63a89c5c
MD5 a8157d23d6555ad647d5857d34838e6b
BLAKE2b-256 dfc68bb430b9cffb29743e1a1a735af8b9636a3e5549b65dec8ec593886938c5

See more details on using hashes here.

File details

Details for the file boolean_question-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for boolean_question-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d9a561ce891fe054167b0442c389b49e99578d64e60655673f38030adf37cfa9
MD5 463a22a147b53571ab9518e7083c3687
BLAKE2b-256 10ece488a47d6b7597087e36277945912f250727036a9cc0a8a63d9dbb85324b

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