Create Your Own LSA Text Summarizer Python

If you need to read long book or article, but you have no time, summarizer will help. It helps if you have no option to get a summary of the text. The first option, you get a summary that created by a human. You can google the summary of the book. But if you didnt get summary that you want, summary machine can help you. I already explain how to create summarizer using luhn and lexrank, in this article I will talk about LSA method to summary. LSA is Latent Semantic Analysis, a computerized based summarization algorithms.

In this article, you can learn how to create summarizer by using lsa method. It is automate process by using python and sumy. I will tell you below, about three process to create lsa summarizer tool.

Lsa summary is One of the newest methods. It is the Latent Semantic Analysis (LSA). An LSA-based summarization using algorithms to create summary for long text.

How to make LSA summary.

First, we have to install a programming language, python.
Next, we’re installing an open source python library, sumy.
Finally, we can finish up with using small code that ready to work.
By reading this article, you can get tool ,a LSA method to summary. You can do itu whenever and for whatever for free.

First, we do first step, install python programming language. Python is a programming language that help us to give a set of instruction to computer.

Python is programming language that you need to create lsa summary.You have another option to create luhn summarizer, but this article give you tutorial to create lsa summarizer using python. Why ? because of I more familiar with this language than another language, like c+, php, java, javascript. How to install python is by download python installer from Then click the installer. For further detail to installation, click here. This paragraph didn’t give you detail tutorial, but the link gives you complete detail to install python. After you install python, go to the next step.

“Next, we will install a python library that suit to summarize, especially lsa summarizer. It is sumy. Sumy is python library that give you programming language to summarize text in several methods. The methods is lexrank, luhn, lsa, et cetera. We didnt reinvent the whell to program summarizer. We can use Sumy. It is one of several summarizer in github. We can install it by open terminal (linux/mac) / command prompt (windows). Type pip install sumy, the your computer install sumy, if you have internet connection.

If your computer can not install by using pip in command prompt or terminal, you can download it in … then open file in command prompt.

After you install sumy, finally, run the program by using this small code. Copy the code below and paste in notepad. Then save as the file with py extension. Do not use default txt extension. For example you save code in file in folder “sumy folder”.

Then the next steps is create blank notepad file. It name source.txt. Why, because the code call it source.txt. If you want to change name, you has to change code.

#Import library essentials
from sumy.parsers.plaintext import PlaintextParser #We're choosing a plaintext parser here, other parsers available for HTML etc.
from sumy.nlp.tokenizers import Tokenizer 
from sumy.summarizers.lsa import LsaSummarizer #We're choosing Luhn, other algorithms are also built in

file = "source.txt" #name of the plain-text file
parser = PlaintextParser.from_file(file, Tokenizer("english"))
summarizer_lsa = LsaSummarizer()

summary_2 =summarizer_lsa(parser.document,5) #Summarize the document with 5 sentences

for sentence in summary_2:
    print sentence

Then copy long text that you want to summarize. Then after that, open by using python IDLE. It is my article about python IDLE.
Then you get a summary of the long text.

“That is three step to create a lsa summarize tool by using python and sumy. Step one is about install python. Step two is about install sumy, after you install python. Then activate sumy by using code to activate lsa methods to summarize. Then you can enjoy summarizer tool by lsa method. You get summary of long text that you want to learn and extract. ”

Leave a Comment

Privacy Preference Center

Google Adsense

We use cookies to make advertising more engaging to users and more valuable to publishers and advertisers. Some common applications of cookies are to select advertising based on what’s relevant to a user; to improve reporting on campaign performance and to avoid showing ads that the user has already seen.

Google uses cookies like NID and SID to help customise adverts on Google properties, such as Google Search. For example, we use such cookies to remember your most recent searches, your previous interactions with an advertiser’s adverts or search results and your visits to an advertiser’s website. This helps us to show you customised adverts on Google.

We also use one or more cookies for advertising that we serve across the web. One of the main advertising cookies on non-Google sites is named ‘IDE‘ and is stored in browsers under the domain Another is stored in and is called ANID. We use other cookies with names such as DSID, FLC, AID, TAID and exchange_uid. Other Google properties, such as YouTube, may also use these cookies to show you more relevant adverts.

Sometimes advertising cookies may be set on the domain of the site that you're visiting. In the case of advertising we serve across the web, cookies named ‘__gads’ or ‘__gac’ may be set on the domain of the site that you're visiting. Unlike cookies that are set on Google's own domains, these cookies can't be read by Google when you're on a site other than the one on which they were set. They serve purposes such as measuring interactions with the ads on that domain and preventing the same ads from being shown to you too many times.

Google also uses conversion cookies whose main purpose is to help advertisers determine how many times the people who click on their adverts end up purchasing their products. These cookies allow Google and the advertiser to determine that you clicked on the advert and later visited the advertiser site. Conversion cookies are not used by Google for personalised ad targeting and persist for a limited time only. A cookie named ‘Conversion‘ is dedicated to this purpose. It's generally set in the domain or the domain (you can find a list of domains that we use for advertising cookies at the foot of this page). Some of our other cookies may be used to measure conversion events as well. For example, DoubleClick and Google Analytics cookies may also be used for this purpose.

We also use cookies named 'AID', 'DSID' and 'TAID', which are used to link your activity across devices if you’ve previously signed in to your Google Account on another device. We do this to coordinate that the ads you see across devices and measure conversion events. These cookies may be set on the domains, or If you don't want the ads that you see to be coordinated across your devices, you can opt out of Ads Personalisation using Ads Settings.

__gads, __gac
__gads, __gac

Google Analytics

We use Google Analytics to analyse the use of our website. Google Analytics gathers information about website use by means of cookies. The information gathered relating to our website is used to create reports about the use of our website. Google’s privacy policy is available at:

ga, gat
ga, gat



e do this in order to identify malicious visitors to our Customers’ websites, to reduce the chance of blocking legitimate users, and to provide customized services.



This cookie is used to provide the social sharing functionality on our careers advice article pages