What is text Summarization?

Hands-on text summarization using Huggingface Transformers Library

ยท

2 min read

Text summarization is the process of reducing a text document to its most important points.

The summary can be generated by extracting information from the text document or abstracting it.

The types of text summarization include extractive and abstractive summarization.

  1. Extractive summarization involves selecting and extracting information from the text document to form the summary.
  2. Conversely, Abstractive summarization involves generating a new summary based on the text document's information.

Applications of text summarization include generating summaries of news articles, emails, and other text documents. Summaries can also be generated from web pages, websites, and books.

It can generate customer feedback or reviews or create text summaries from social media posts.

Text Summarization code example using Huggingface Transformers Library

from transformers import pipeline

summarizer = pipeline("summarization",device=0)
text = """
    America has changed dramatically during recent years. Not only has the number of 
    graduates in traditional engineering disciplines such as mechanical, civil, 
    electrical, chemical, and aeronautical engineering declined, but in most of 
    the premier American universities engineering curricula now concentrate on 
    and encourage largely the study of engineering science. As a result, there 
    are declining offerings in engineering subjects dealing with infrastructure, 
    the environment, and related issues, and greater concentration on high 
    technology subjects, largely supporting increasingly complex scientific 
    developments. While the latter is important, it should not be at the expense 
    of more traditional engineering.
"""
summarizer(text, max_length=30, min_length=10)
[{'summary_text': ' America has changed dramatically during recent years . There are declining offerings in engineering subjects dealing with infrastructure,  the environment, and related issues .'}]

Learn How to use Hugging face Transformers Library

Looking to get started with using the transformers library from Hugging Face? Check out this video explaining how to perform various tasks like

  1. Classification
  2. Question Answering
  3. NER
  4. Summarization
  5. Text Generation

NLP Beginner to Advanced Playlist

This playlist is for you if you want to get started with NLP or level up your skills.

It covers everything from basic text classification to deploying a fine-tuned transformer model on AWS. And it's all delivered in a hands-on, code-along format.

ย