Esempio n. 1
0
File: views.py Progetto: recsm/SQP
def get_num_words(request):
    """A view used to test NLP"""
    if request.method == 'POST':
        try:
            text = request.POST['original']
            num_words = nlp_tools.count_words(text)
        except:
            num_words = 'error'
    else:
        num_words = ''
    return render_to_response('sqp/get_quantity.html', {'quantity'
                              : num_words})
Esempio n. 2
0
def int_num_words(question, characteristic):
    "Suggestion for number of words in introduction."
    return nlp_tools.count_words(question.introduction_text), None
Esempio n. 3
0
def ans_num_words(question, characteristic):
    "Suggestion for number of words in answer categories."
    return nlp_tools.count_words(question.answer_text), None
Esempio n. 4
0
def rfa_num_words(question, characteristic):
    "Suggestion for number of words in Request for an Answer (RFA)."
    return nlp_tools.count_words(question.rfa_text), None