CommencerCommencer gratuitement

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

Travailler avec Hugging Face

Afficher le cours

Instructions

  • Créez un pipeline pour la tâche text-classification en utilisant le modèle "abdulmatinomotoso/English_Grammar_Checker", et enregistrez-le sous le nom grammar_checker.
  • Utilisez grammar_checker pour prédire la correction grammaticale de la phrase fournie et enregistrez le résultat dans output.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# 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)
Modifier et exécuter le code