Text Summarization is an important task for large documents to get the idea of the document. There are two main summarization techniques used in NLP for text summarization.
Extractive Text Summarization: This approach's name is self-explanatory. Most important sentences or phrases are extracted from the original text and a short summary provided with these important sentences. See the figure for the explanation.Abstractive Text Summarization: This approach uses more advanced deep learning techniques to generate new sentences by learning from the original text. It is a complex task and requires heavy computing power such as GPU.
Let's dive into the code for generating the text summary. I'm using Arabic as a parameter because the contributor did an excellent job of handling a lot of things like stemming, Urdu characters support, etc.
from summa.summarizer import summarize
text = """ اسلام آباد: صدر مملکت ڈاکٹر عارف علوی بھی کورونا وائرس کا شکار ہوگئے۔
سماجی رابطے کی ویب سائٹ ٹویٹر پر ڈاکٹر عارف علوی نے لکھا کہ میرا کورونا ٹیسٹ مثبت آگیا ہے،
اللہ سب کورونا متاثرین پر رحم فرمائے، ویکسین کی پہلی خوراک لی تھی جب کہ دوسری ڈوز ایک ہفتے
بعد لگنی تھی جس کے بعد اینٹی باڈیز بننا شروع ہوتی ہیں، برائے مہربانی محتاط رہیں۔"""
summary = summarize(text, ratio=0.2, language="arabic", words=15)
print(summary)
and here is the output:
سماجی رابطے کی ویب سائٹ ٹویٹر پر ڈاکٹر عارف علوی نے لکھا کہ میرا کورونا ٹیسٹ مثبت آگیا ہے،
Isn't it easy!!! Let me know if you have any questions.
Irfan! Sent u an email regarding development of an urdu sentiment analysis library.
ReplyDeleteHi Irfan, can you help doing urdu text summarization using spacy.
ReplyDeleteSpaCy does not provide summarization.
ReplyDeletewhich algorithm or technique you are using
ReplyDeleteThis only works with the provided text.If you change the text, it shows nothing.
ReplyDeleteCheck documentation.
Deletevirtuoso.irfan@gmail.com
ReplyDeletehey its only working for the given text
ReplyDelete