From the course: Evaluating and Debugging Generative AI

Unlock the full course today

Join today to access over 23,400 courses taught by industry experts.

Challenge: Analyze text output

Challenge: Analyze text output

Welcome to your next hands-on challenge. In this challenge, you will evaluate the quality of text generated by a model using the BLEU score. First, you'll explore Python's Natural Language Toolkit, nltk library, which has built-in support for calculating BLEU scores. Make sure you import the necessary libraries before using them. Next, you'll use three examples as the human-generated reference texts. The reference texts include "Discovering new skills is both enjoyable and thrilling," "It's exciting and enjoyable to learn new things," and "Gaining new knowledge can be fun and exhilarating." And the following text you'll use as the candidate text or the machine-generated text. "Learning new stuff is fun and exciting." Lastly, you'll use the sentence_bleu function to calculate the BLEU score. Good luck and have fun. I can't wait to show you how I solved this challenge.

Contents