Blame view

webtagger.py 820 Bytes
ffd3b3723   Killian   idem
1
2
3
4
5
  # -*- coding: utf-8 -*- 
  import subprocess
  import os
  import json
  from flask import Flask, request, render_template
e0e492698   Killian   Passage au proces...
6
  from processor.LiaTools import *
b3cdd2e74   Killian   Ajout de Orkis pr...
7
  from processor.Orkis import Orkis
ffd3b3723   Killian   idem
8
9
10
11
12
13
14
15
  app = Flask(__name__)
  
  @app.route("/")
  def docs():
      return render_template('index.html')
  
  @app.route("/tagger",methods=['POST'])
  def cleaner():
7ff5cc7f9   Killian   edit raw text + c...
16
17
      # Receive String from post parametre Raw text
      dirtyString= request.values[u'string']
b3cdd2e74   Killian   Ajout de Orkis pr...
18
19
      # Charging Processor et check if they are okay ( aim is to dynamic charge later ) 
      orkisProc = Orkis(dirtyString)
7ff5cc7f9   Killian   edit raw text + c...
20
      # Processing 
7ff5cc7f9   Killian   edit raw text + c...
21
      # Adding lemm of each words cause we went ther phonem too
b3cdd2e74   Killian   Ajout de Orkis pr...
22
      taggedTable= orkisProc.getDico()
7ff5cc7f9   Killian   edit raw text + c...
23
      # Returning a row text to be parse client side
b3cdd2e74   Killian   Ajout de Orkis pr...
24
      return unicode(taggedTable)
ffd3b3723   Killian   idem
25
26
27
  if __name__ == '__main__':
      app.debug = True
      app.run(host='0.0.0.0')