Esempio n. 1
0
def allJson():
    review_text = processJsonRequest()
    output = []
    for reviews in review_text:
        total_volume, volume_without_stopwords = predictVolume(reviews['text'])
        sentiment_tone, sentiment_score, sentiment_confidence = predictSentiment(
            reviews['text'])
        suggestions, suggestion_confidence = predictSuggestions(
            reviews['text'])
        praise, criticism, emotion_confidence = predictEmotion(reviews['text'])
        problem, problem_confidence = predictProblem(reviews['text'])
        result = {
            'id': reviews['id'],
            'text': reviews['text'],
            'Total_volume': total_volume,
            'Volume_without_stopwords': volume_without_stopwords,
            'Sentiment_tone': sentiment_tone,
            'Sentiment_score': sentiment_score,
            'Suggestions': suggestions,
            'Praise': praise,
            'Criticism': criticism,
            'Problem': problem,
        }
        output.append(result)
    return jsonify({'reviews': output})
Esempio n. 2
0
def problemJson():
    review_list = processJsonRequest()
    problem_output = []
    for review in review_list:
        problem = predictProblem(review['text'])
        problem_result = {'id': review['id'], 'text': review['text'], "problems": problem}
        problem_output.append(problem_result)
    return renderJsonResponse(problem_output)
Esempio n. 3
0
def problemConfidenceJson():
    review_list = processJsonRequest()
    problem_confidence_output = []
    for review in review_list:
        problem, confidence = predictProblem(review['text'])
        problem_result = {
            'id': review['id'],
            'text': review['text'],
            "confidence": confidence
        }
        problem_confidence_output.append(problem_result)
    return renderJsonResponse(problem_confidence_output)
Esempio n. 4
0
def allConfidenceJson():
    review_text = processJsonRequest()
    output = []
    for reviews in review_text:
        sentiment_tone, sentiment_score, sentiment_confidence = predictSentiment(
            reviews['text'])
        suggestions, suggestion_confidence = predictSuggestions(
            reviews['text'])
        praise, criticism, emotion_confidence = predictEmotion(reviews['text'])
        problem, problem_confidence = predictProblem(reviews['text'])
        result = {
            'id': reviews['id'],
            'text': reviews['text'],
            'Confidence': {
                "Sentiment": sentiment_confidence,
                "Suggestions": suggestion_confidence,
                "Emotion": emotion_confidence,
                "Problem": problem_confidence
            }
        }
        output.append(result)
    return jsonify({'reviews': output})