Blame view

webtagger.py 1.08 KB
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
6c1479b8b   Killian   Modification Orkis
8
  from flaskext.enterprise import Enterprise
ffd3b3723   Killian   idem
9
  app = Flask(__name__)
6c1479b8b   Killian   Modification Orkis
10
  enterprise = Enterprise(app)
ffd3b3723   Killian   idem
11
12
13
14
15
16
17
  
  @app.route("/")
  def docs():
      return render_template('index.html')
  
  @app.route("/tagger",methods=['POST'])
  def cleaner():
7ff5cc7f9   Killian   edit raw text + c...
18
19
      # Receive String from post parametre Raw text
      dirtyString= request.values[u'string']
b3cdd2e74   Killian   Ajout de Orkis pr...
20
21
      # Charging Processor et check if they are okay ( aim is to dynamic charge later ) 
      orkisProc = Orkis(dirtyString)
7ff5cc7f9   Killian   edit raw text + c...
22
      # Processing 
7ff5cc7f9   Killian   edit raw text + c...
23
      # Adding lemm of each words cause we went ther phonem too
b3cdd2e74   Killian   Ajout de Orkis pr...
24
      taggedTable= orkisProc.getDico()
7ff5cc7f9   Killian   edit raw text + c...
25
      # Returning a row text to be parse client side
b3cdd2e74   Killian   Ajout de Orkis pr...
26
      return unicode(taggedTable)
6c1479b8b   Killian   Modification Orkis
27
28
29
30
31
32
  
  class OrkisService(enterprise.SOAPService):
      @enterprise.soap(enterprise.String,_returns=enterprise._sp.String)
      def get_phon(self,string):
          orkisProc=Orkis(string)
          return orkisProc.getDico()
ffd3b3723   Killian   idem
33
34
35
  if __name__ == '__main__':
      app.debug = True
      app.run(host='0.0.0.0')