eKorpus

Source code for ekorpus.controllers.valence

# -*- coding: utf-8 -*-
"""The :mod:`valence` contains text valence related methods."""
import os
import cgi
from ekorpus.lib.base import *
from valencecolor import marktext

[docs]class ValenceController(BaseController):
[docs] def index(self): """Generates the text input form.""" return render('/valence/valence.mak')
[docs] def color(self): """Count and mark with a color the valence keywords.""" p = request.params #if 'questions' in p: # questions = p['questions'] # if isinstance(questions,cgi.FieldStorage): # self._store_test(questions.file, c.test) if ('text' in p) and p['text']: c.text=marktext(p['text']) else: c.text = "Nothing" return render('/valence/colored.mak')