Blame view
webtagger.py
1.06 KB
ffd3b3723 idem |
1 2 3 4 |
# -*- coding: utf-8 -*- import subprocess import os import json |
9aab1de73 Tentative Soap in... |
5 |
from lxml import etree |
ffd3b3723 idem |
6 |
from flask import Flask, request, render_template |
e0e492698 Passage au proces... |
7 |
from processor.LiaTools import * |
b3cdd2e74 Ajout de Orkis pr... |
8 |
from processor.Orkis import Orkis |
6c1479b8b Modification Orkis |
9 |
from flaskext.enterprise import Enterprise |
9aab1de73 Tentative Soap in... |
10 |
from time import ctime |
ffd3b3723 idem |
11 |
app = Flask(__name__) |
6c1479b8b Modification Orkis |
12 |
enterprise = Enterprise(app) |
ffd3b3723 idem |
13 14 15 16 17 18 19 |
@app.route("/") def docs(): return render_template('index.html') @app.route("/tagger",methods=['POST']) def cleaner(): |
7ff5cc7f9 edit raw text + c... |
20 21 |
# Receive String from post parametre Raw text dirtyString= request.values[u'string'] |
b3cdd2e74 Ajout de Orkis pr... |
22 23 |
# Charging Processor et check if they are okay ( aim is to dynamic charge later ) orkisProc = Orkis(dirtyString) |
7ff5cc7f9 edit raw text + c... |
24 |
# Processing |
7ff5cc7f9 edit raw text + c... |
25 |
# Adding lemm of each words cause we went ther phonem too |
b3cdd2e74 Ajout de Orkis pr... |
26 |
taggedTable= orkisProc.getDico() |
7ff5cc7f9 edit raw text + c... |
27 |
# Returning a row text to be parse client side |
b3cdd2e74 Ajout de Orkis pr... |
28 |
return unicode(taggedTable) |
6c1479b8b Modification Orkis |
29 30 |
class OrkisService(enterprise.SOAPService): |
9aab1de73 Tentative Soap in... |
31 32 33 |
@enterprise.soap(returns=enterprise._sp.String) def get_phon(self): return ctime() |
6c1479b8b Modification Orkis |
34 |
|
ffd3b3723 idem |
35 36 37 |
if __name__ == '__main__': app.debug = True app.run(host='0.0.0.0') |