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

def docs():
    return render_template('index.html')

def cleaner():
    tagger = Tagger()
    phoner = Phoner()
    stoplist = StopWord()
    # 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
    dirtyString = stoplist.RemoveStopList(dirtyString)
    print " stop list " + dirtyString
    lemm = tagger.lemm(tagger.clean(dirtyString))
    print 'les lemm '+ lemm
    dirtyString = dirtyString+" "+ lemm
    cleanString= phoner.clean(dirtyString)
    taggedString= phoner.phon(cleanString)
    print taggedString
    return taggedString
if __name__ == '__main__':
    app.debug = True