Summarizing Documents with T5-Large
Learn about how different documents are summarized with the T5-large model.
Now let’s summarize documents.
In this lesson, we will create a summarizing function that you can call with any text you wish to summarize. We will summarize legal and financial examples. Finally, we will define the limits of the approach.
Creating a summarization function
First, let’s create a summarizing function named summarize
. That way, we will just send the texts we want to summarize to our function. The function takes two parameters. The first parameter is preprocess_text
, the text to summarize. The second parameter is ml
, the maximum length of the summarized text. Both parameters are variables we send to the function each time we call it:
Get hands-on with 1400+ tech skills courses.