-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.py
57 lines (42 loc) · 1.6 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
49
50
51
52
53
54
55
56
57
# -*- coding: utf-8 -*-
from flask import Flask, render_template, request
import requests
import nltk
app = Flask(__name__)
@app.route('/', methods=['GET'])
@app.route('/index', methods=['GET'])
def index():
return render_template('index.html')
@app.route('/portfolio', methods=['GET'])
def portfolio():
return render_template('portfolio.html')
@app.route('/blog', methods=['GET'])
def blog():
return render_template('blog.html')
@app.route('/about', methods=['GET'])
def about():
return render_template('about.html')
@app.route('/contact', methods=['GET'])
def contact():
return render_template('contact.html')
@app.route('/demos', methods=['GET'])
def demos():
return render_template('demos.html')
@app.route('/demos/preprocessing', methods=['GET'])
def preprocessing():
return render_template('/demos/preprocessing/preprocessing.html')
@app.route('/demos/preprocessing/tokenization', methods=['GET', 'POST'])
def tokenization():
if request.method == 'POST':
input = request.form['tokenize_input']
words = nltk.word_tokenize(input)
return render_template('/demos/preprocessing/tokenization.html', output=str(words), input=input)
return render_template('/demos/preprocessing/tokenization.html')
@app.route('/demos/preprocessing/normalization', methods=['GET'])
def normalization():
return render_template('/demos/preprocessing/normalization.html')
@app.route('/demos/preprocessing/noise-removal', methods=['GET'])
def noise_removal():
return render_template('/demos/preprocessing/noise-removal.html')
if __name__ == "__main__":
app.run(debug=True)