-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
48 lines (36 loc) · 1.02 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# imports
from flask import Flask, render_template, request, redirect
import json, requests, sys
import summaly
import summarize
from nltk.corpus import wordnet as wn
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def index():
errors = ""
if request.method == 'GET':
return render_template("index.html",errors= errors)
else :
query = ""
query = request.form['name']
if query == "":
return "No Query "
url = "http://en.wikipedia.org/wiki/"+ query.lower()
'''
word = Word(query)
word.synsets[:5]
defi = word.definitions[0]()
'''
defi = ""
summary = ""
if defi :
summary += defi
text = summarize.summarize(url, query.lower())
summary += text
'''word = summary.split()
sent = ""
for w in word :
sent += word + "%20"'''
return render_template("index.html",summary = summary)
if __name__ == '__main__':
app.run()