Exemple #1
0
def getSMSAndAnalyze():     
    resp = MessagingResponse()
    number = request.form['From']
    message_body = request.form['Body']    
    sAnalysis = TextBlob(message_body) #Lets use TextBlob for the SA
    #You can also get the subjectivity too by using
    sAnalysis.subjectivity()
    #Simple SA stuff with emoji's attached
    if sAnalysis.polarity > 0.5: #Positive
                
        resp.message("I'am glad you like it! \U0001F602")   
        
    else:
        dm.doEmail(message_body)
        resp.message("Sorry to hear that! How can we improve \U0001F621")
        
    # TODO: 001002 -  Add SQL Server integration and Goldmine or other CRM
    return str(resp)