Correction grammaticale
La classification de texte consiste à attribuer une catégorie prédéfinie à un texte en entrée. Cela peut correspondre à l’analyse de sentiment — positive ou negative —, à la détection de spam — spam ou not spam —, et même à l’identification d’erreurs grammaticales.
Découvrez comment utiliser un pipeline de type text-classification pour vérifier la présence d’erreurs grammaticales dans une phrase en entrée.
pipeline de la bibliothèque transformers est déjà importé pour vous.
Cet exercice fait partie du cours
<cours>Travailler avec Hugging Face</cours>Instructions de l’exercice
- Créez un pipeline pour la tâche
text-classificationen utilisant le modèle"abdulmatinomotoso/English_Grammar_Checker", et enregistrez-le sous le nomgrammar_checker. - Utilisez
grammar_checkerpour prédire la correction grammaticale de la phrase fournie et enregistrez le résultat dansoutput.
Exercice interactif pratique
Essayez cet exercice en complétant ce code d’exemple.
# Create a pipeline for grammar checking
____ = ____(
____="text-classification",
____="abdulmatinomotoso/English_Grammar_Checker"
)
# Check grammar of the input text
output = ____("I will walk dog")
print(output)