Easy to Create Automatic Luhn Summarizer

Too much data. But, too little time to study. If you need to get a summary of long text to study, this article give you a tool to summarize long article using Luhn summary methodology. That is automated by using python and sumy.

In this article, we’re going to look at three step to help you get a tool to get luhn summary of long text. in quickly, and easily. Because, it uses computer to do.

Luhn summary is one method to summarize based on TF IDF and looking at the windows size of non important word between high important. It also assigns higher weights to sentences occurring near the beginning of a document.The text summarization algorithms was published in 1958 by Hans Peter Luhn, working at IBM research.

First, we’re has to install pyhon.
Next, we’re install a python library, sumy.
Finally, we are finish up with using code and also long text to summarize. .
After reading this article, you’ll have tool,a luhn method to summary. You can do itu whenever and for whatever for free.

First, let’s talk about how to install python.
Python is programming language that you need to create luhn summary.It is not the only option, it is one of several programming language, c+, php, java, javascript. But this tutorial is about luhn summarizer using python. How to install python is by download python installer from python.org. Then click the installer. For further detail to installation, click here.
This paragragh didnt give you detail tutorial, but the link give you complete detail to install python. After you install python, go to the next step.

“Next, we will tell you about install sumy. Sumy is python library that give you programming language to summarize text in several methods. We didnt reinvent the whell to program summarizer. Sumy 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 setup.py 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 luhn.py in folder “sumy folder”.

#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.luhn import LuhnSummarizer #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_luhn = LuhnSummarizer()

summary = summarizer_luhn(parser.document, 5) #Summarize the document with 5 sentences

for sentence in summary:
    print sentence

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.

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

“That is three step to create a 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. Then you can enjoy summarizer tool by luhn method. You get summary of long text that you want to learn and extract. ”

Another methods? Check link below

Leave a Comment