Skip to main content

Fill the blank using transformers

Project description

Fill Blank

In our early education day, while learning english one of the most important task was to fill the blanks.

Two type of question was provided:

  • Cloze test with clues
  • Cloze test without clues

It was totally difficult for non native English learner to fill the blanks. And cloze test without cloze was the most trickier.

But now a days machine can fill the blanks smartly. Mask Language Modeling(MLM) based language model give machine such power.

FillBlank is an BERT based package, can fill cloze test without clues type text. This package mostly build using huggingface transformers.

Installation

pip install fillblank

Dependency

  • pytorch 1.6+

How to Fill The Blank

from fillblank.fillblank import FillBlank
text = "what a <blank>! She <blank> to eat."
filltheblank = FillBlank()
output, output_dictionary = filltheblank.fill(text)
print(output)
print(output_dictionary['predict_words']) 
# what a <mess>! she <needed> to eat.
#['mess', 'needed']

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

fillblank-1.0.1.tar.gz (2.2 kB view hashes)

Uploaded Source

Built Distribution

fillblank-1.0.1-py3-none-any.whl (3.5 kB view hashes)

Uploaded Python 3

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