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():
    # Charging Processor et check if they are okay ( aim is to dynamic charge later ) 
    tagger = Tagger()
    phoner = Phoner()
    stoplist = StopWord()
    # Receive String from post parametre Raw text
    dirtyString= request.values[u'string']
    # Processing 
    dirtyString = stoplist.RemoveStopList(dirtyString)
    lemm = tagger.lemm(tagger.clean(dirtyString))
    # Adding lemm of each words cause we went ther phonem too
    dirtyString = dirtyString+" "+ lemm
    cleanString= phoner.clean(dirtyString)
    taggedString= phoner.phon(cleanString)
    # Returning a row text to be parse client side
    return taggedString
if __name__ == '__main__':
    app.debug = True