webtagger.py 727 Bytes
# -*- coding: utf-8 -*- 
import subprocess
import os
import json
from flask import Flask, request, render_template
from processor.LiaTools import *
app = Flask(__name__)

@app.route("/")
def docs():
    return render_template('index.html')

@app.route("/tagger",methods=['POST'])
def cleaner():
    tagger = Tagger()
    # Receive String from post parametre Raw text ( Json )
    dirtyString= request.json[u'string']
    # send the String throught LIA_TAGG script  thank's to pip
    # lia_clean split a word by line et markup the sentences
    cleanString= tagger.clean(dirtyString)
    taggedString= tagger.tagg(cleanString)
    return taggedString
if __name__ == '__main__':
    app.debug = True
    app.run(host='0.0.0.0')