Blame view

webtagger.py 1.05 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 *
ffd3b3723   Killian   idem
7
8
9
10
11
12
13
14
  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...
15
      # Charging Processor et check if they are okay ( aim is to dynamic charge later ) 
e0e492698   Killian   Passage au proces...
16
      tagger = Tagger()
673721ec0   Killian   ajout phon il ma...
17
18
19
20
21
      tagger.isReady()
      phoner = Phoner()
      phoner.isReady()
      stoplist = StopWord()
      stoplist.isReady()
7ff5cc7f9   Killian   edit raw text + c...
22
23
24
      # Receive String from post parametre Raw text
      dirtyString= request.values[u'string']
      # Processing 
673721ec0   Killian   ajout phon il ma...
25
      dirtyString = stoplist.RemoveStopList(dirtyString)
673721ec0   Killian   ajout phon il ma...
26
      lemm = tagger.lemm(tagger.clean(dirtyString))
7ff5cc7f9   Killian   edit raw text + c...
27
      # Adding lemm of each words cause we went ther phonem too
673721ec0   Killian   ajout phon il ma...
28
29
30
      dirtyString = dirtyString+" "+ lemm
      cleanString= phoner.clean(dirtyString)
      taggedString= phoner.phon(cleanString)
7ff5cc7f9   Killian   edit raw text + c...
31
      # Returning a row text to be parse client side
e0e492698   Killian   Passage au proces...
32
      return taggedString
ffd3b3723   Killian   idem
33
34
35
  if __name__ == '__main__':
      app.debug = True
      app.run(host='0.0.0.0')