Пример #1
0
def process_processor_result(result, callingCode):
  print("Received text: '%s'" % result)
  if((callingCode not in processedRounds) and len(result.split()) > 2):
    if "steve" in result.lower():
          question = result[(result.lower().index("steve") + len("setve")):len(result)]

          if(len(question.split()) > 2):
            processedRounds.append(callingCode)
            print("Steve thinks you said: %s" % question)
            AIBot.query(question)
Пример #2
0
 def on_data(self, dataTwitter):
     global dataCheck
     text = json.loads(dataTwitter)['text'].replace("@ArmHackathonBot ", "")
     isTalkToSteve = "#TalkToSteve" in text
     text = text.replace("#PublicOpinion", "")
     text = text.replace("#TalkToSteve", "")
     name = json.loads(dataTwitter)['user']['name']
     nameTwitter = json.loads(dataTwitter)['user']['screen_name']
     #get data
     if isTalkToSteve:
         AIBot.query(text)
     else:
         processTweet(text,name,nameTwitter)
     dataCheck = True
     return True