Blame view

webtagger.py 727 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 *
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():
e0e492698   Killian   Passage au proces...
15
      tagger = Tagger()
ffd3b3723   Killian   idem
16
17
      # Receive String from post parametre Raw text ( Json )
      dirtyString= request.json[u'string']
e0e492698   Killian   Passage au proces...
18
      # send the String throught LIA_TAGG script  thank's to pip
ffd3b3723   Killian   idem
19
      # lia_clean split a word by line et markup the sentences
e0e492698   Killian   Passage au proces...
20
21
22
      cleanString= tagger.clean(dirtyString)
      taggedString= tagger.tagg(cleanString)
      return taggedString
ffd3b3723   Killian   idem
23
24
25
  if __name__ == '__main__':
      app.debug = True
      app.run(host='0.0.0.0')