示例#1
0
def processTweet(text, name, nameTwitter):
    value = sentimentValue(searchTwitter(text))

    emotion = "unhappy" if (value < 0) else "happy"
    adjective = "negative" if (value < 0) else "positive"

    TALK.say_message("!%s I have just received a tweet. It appears that on the subject of %s, the public's perception is %s" % (emotion, text, adjective))
示例#2
0
def query(message):
  print("querying message: '%s'" % message)
  message_response = get_response(message)
  if len(message_response) > 0:
    TALK.say_message(message_response)
  else:
    ACTION.action_be_confused()
    TALK.say_message(CONFUSE_RESPONSE)
示例#3
0
def searchTwitterForValue(text):
    value = sentimentValue(searchTwitter(text))

    emotion = "unhappy" if (value < 0) else "happy"
    adjective = "negative" if (value < 0) else "positive"

    TALK.say_message("!%s It appears that the public's perception of your question is %s" % (emotion, adjective))


    return value
示例#4
0
def weather_summary(location):
  location = geolocator.geocode(location)
  lat = location.latitude
  lng = location.longitude
  forecast = forecastio.load_forecast(api_key, lat, lng, units="uk")
  by_day = forecast.daily()
  if by_day.icon == "rain" or by_day.icon == "wind"  or by_day.icon == "sleet" or by_day.icon == "fog":
    ACTION.action_be_unhappy()
  else:
    ACTION.action_be_happy()
  TALK.say_message(by_day.summary)