def post(self):
parser = reqparse.RequestParser()
parser.add_argument('text', location='form', required=True)
args = parser.parse_args()
emotion = comment_emotions.emotions(args['text'], g)
sentic_values = emotion.get_all_sentic_values()
compound_emotions = emotion.get_compound_emotion()
sentic_values = [e.name for e in sentic_values if e is not None]
compound_emotions = [(e.name, v.name) for e, v in compound_emotions]
return {
'sentic_values': sentic_values,
'compound_emotions': compound_emotions
}
评论列表
文章目录