Commit 1db021bcb8e6758fda32b6e9ddef132ae3c63b67
1 parent
673721ec07
Exists in
master
and in
1 other branch
salut
Showing 1 changed file with 1 additions and 1 deletions Inline Diff
webtagger.py
1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
2 | import subprocess | 2 | import subprocess |
3 | import os | 3 | import os |
4 | import json | 4 | import json |
5 | from flask import Flask, request, render_template | 5 | from flask import Flask, request, render_template |
6 | from processor.LiaTools import * | 6 | from processor.LiaTools import * |
7 | app = Flask(__name__) | 7 | app = Flask(__name__) |
8 | 8 | ||
9 | @app.route("/") | 9 | @app.route("/") |
10 | def docs(): | 10 | def docs(): |
11 | return render_template('index.html') | 11 | return render_template('index.html') |
12 | 12 | ||
13 | @app.route("/tagger",methods=['POST']) | 13 | @app.route("/tagger",methods=['POST']) |
14 | def cleaner(): | 14 | def cleaner(): |
15 | tagger = Tagger() | 15 | tagger = Tagger() |
16 | tagger.isReady() | 16 | tagger.isReady() |
17 | phoner = Phoner() | 17 | phoner = Phoner() |
18 | phoner.isReady() | 18 | phoner.isReady() |
19 | stoplist = StopWord() | 19 | stoplist = StopWord() |
20 | stoplist.isReady() | 20 | stoplist.isReady() |
21 | # Receive String from post parametre Raw text ( Json ) | 21 | # Receive String from post parametre Raw text ( Json ) |
22 | dirtyString= request.json[u'string'] | 22 | dirtyString= request.json[u'string'] |
23 | # send the String throught LIA_TAGG script thank's to pip | 23 | # send the String throught LIA_TAGG script thank's to pipe |
24 | # lia_clean split a word by line et markup the sentences | 24 | # lia_clean split a word by line et markup the sentences |
25 | dirtyString = stoplist.RemoveStopList(dirtyString) | 25 | dirtyString = stoplist.RemoveStopList(dirtyString) |
26 | print " stop list " + dirtyString | 26 | print " stop list " + dirtyString |
27 | lemm = tagger.lemm(tagger.clean(dirtyString)) | 27 | lemm = tagger.lemm(tagger.clean(dirtyString)) |
28 | print 'les lemm '+ lemm | 28 | print 'les lemm '+ lemm |
29 | dirtyString = dirtyString+" "+ lemm | 29 | dirtyString = dirtyString+" "+ lemm |
30 | cleanString= phoner.clean(dirtyString) | 30 | cleanString= phoner.clean(dirtyString) |
31 | taggedString= phoner.phon(cleanString) | 31 | taggedString= phoner.phon(cleanString) |
32 | print taggedString | 32 | print taggedString |
33 | return taggedString | 33 | return taggedString |
34 | if __name__ == '__main__': | 34 | if __name__ == '__main__': |
35 | app.debug = True | 35 | app.debug = True |
36 | app.run(host='0.0.0.0') | 36 | app.run(host='0.0.0.0') |
37 | 37 |