Python – Spell Checker using Flask + TextBlob + Bootstrap 4

Hello everyone, In this tutorial, we will show you how to develop the simple spell checker application using Flask, TextBlob and Bootstrap 4. The example program has been tested and shared in the post.

Flask Service Layer

from flask import Flask, render_template, request
from textblob import TextBlob
app = Flask(__name__)
def home():
return render_template('index.html')
@app.route('/correct', methods=['POST'])
def correct():
if request.method == 'POST':
input = request.form['input']
text = TextBlob(input)
return render_template('index.html', input=text, output=text.correct())

Flask View Layer

<title>Spell Checker</title>
<link rel="stylesheet" href="" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<body class="container">
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<a class="navbar-brand" href="#">Spell Checker</a>
<div class="row justify-content-center">
<div class="col-11">
<form action="/correct" method="post">
<div class="form-group">
<label for="input">Input</label>
<textarea class="form-control" id="input" name="input" rows="5">{{ input }}</textarea>
<div class="form-group">
<button type="submit" class="btn btn-primary">Correct</button>
<button type="reset" class="btn btn-danger">Clear</button>
<div class="form-group">
<label for="output">Output</label>
<textarea class="form-control" id="output" name="output" rows="5">{{ output }}</textarea>


Spell Checker using Flask + TextBlob + Bootstrap 4



No Responses

Leave a Reply

Your email address will not be published.