├── LICENSE ├── Output └── Demo_TextSummarization.mp4 ├── Output_TextSumm.gif ├── README.md ├── __init__.py ├── main.py └── templates ├── Output_Content.html └── index.html /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 M Vamshi Krishna 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Output/Demo_TextSummarization.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vamshi0104/Text-Summarization/09205bdc8f91634374693d6dcb03ede3e39c3efd/Output/Demo_TextSummarization.mp4 -------------------------------------------------------------------------------- /Output_TextSumm.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vamshi0104/Text-Summarization/09205bdc8f91634374693d6dcb03ede3e39c3efd/Output_TextSumm.gif -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Text-Summarization 2 | Text-Summarization through FLASK using NLP 3 | ---------------------------------------------------------------- 4 | Hey,user if you have idea about FLASK feel free to skip the below section or just have a look. 5 | ##### FLASK: 6 | Flask is a micro web framework written in Python. It is classified as a microframework because it does not require particular tools or libraries. It has no database abstraction layer, form validation, or any other components where pre-existing third-party libraries provide common functions. 7 | ### Working of this Application : 8 | Firstly the Application is Command line based executable under Python Environment and 9 | uses popular Python micro web framework that is FLASK.This Application consist of 2 main pages runs in LocalHost wherein intially a form is given to the user based on the content entered and on submit by the user,Accordingly the Summarizied Content is analyzed with support and importing of some python packages.This data is exported to the next connecting page. 10 | 11 | ##### Basically This project comprises of Three Modules : 12 | * Index Page 13 | * Exporting Summarized Content 14 | 15 | ### Software Requirements: 16 | * ##### Python 3+ any version or editors like Pycharm(Used in creating this application in Windows) 17 | * ##### Install Python Libraries as follows , 18 | Run the these Commands in the Pycharm (venv) or CMD(for Windows) : 19 | 20 | * For installing FLASK,follow the below link as follows: 21 | ##### >>> Click to view documentation for [Flask-Install](https://dev.to/sahilrajput/install-flask-and-create-your-first-web-application-2dba) 22 | 23 | 24 | * For Review Analysis,importing vadersentiment is required ,thus run the command as follows: 25 | > pip install nlp 26 | 27 | * For exporting and processing the data,run the following script in new .py file before ruuning the application as follows: 28 | > import nltk 29 | > nltk.download('stopwords') 30 | > nltk.download('word_tokenize') 31 | > nltk.download('sent_tokenize') 32 | > 33 | 34 | * After installing above libraries,we need to import those and use the functionality in this application. 35 | 36 | #### In order to run and intialize the application there are 2 alternative methods : 37 | 38 | * Method - 1 : Run from Editor in venv and view localhost application in any Browser with link (http://127.0.0.1:5000/) 39 | * Method - 2 : Run from command prompt with specified path location of project by using following command 40 | > python __init__.py 41 | 42 | 43 | ##### Note : Detail-Working Demo of the Application is attached to the "/Output" folder of Repository 44 | 45 | 46 | 47 | ### Here is the Quick glimpse of Application : 48 | 49 |  50 | 51 | 52 | > Happy Coding :) 53 | -------------------------------------------------------------------------------- /__init__.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, redirect, url_for, request ,render_template 2 | from main import * 3 | app = Flask(__name__) 4 | 5 | @app.route('/') 6 | def index(): 7 | return render_template("index.html") 8 | 9 | @app.route('/output',methods=['POST']) 10 | def output(): 11 | if request.method == 'POST': 12 | textvalue = request.form.get("textarea", None) 13 | return render_template('Output_Content.html', res=outputsumm(textvalue)) 14 | 15 | if __name__ == '__main__': 16 | app.run(debug=True) -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | import nltk 2 | from nltk.corpus import stopwords 3 | from nltk.tokenize import word_tokenize, sent_tokenize 4 | 5 | def outputsumm(input_text): 6 | stopWords = set(stopwords.words("english")) 7 | words = word_tokenize(input_text) 8 | f = dict() 9 | for i in words: 10 | i = i.lower() 11 | if i in stopWords: 12 | continue 13 | if i in f: 14 | f[i] += 1 15 | else: 16 | f[i] = 1 17 | sentences = sent_tokenize(input_text) 18 | fsent = dict() 19 | for j in sentences: 20 | for x, y in f.items(): 21 | if x in j.lower(): 22 | if j in fsent: 23 | fsent[j] += y 24 | else: 25 | fsent[j] = y 26 | count = 0 27 | for k in fsent: 28 | count += fsent[k] 29 | average = int(count / len(fsent)) 30 | output_text = '' 31 | for p in sentences: 32 | if (p in fsent) and (fsent[p] > (1.2 * average)): 33 | output_text += " "+p 34 | return output_text 35 | -------------------------------------------------------------------------------- /templates/Output_Content.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 |