Exemplo n.º 1
0
def speak():
    alfred = AlfredSpeech()
    data = request.get_json()
    message = data["message"]

    if message == "alfred":
        greeting = SpeechHelpers()

        alfred.respond(greeting.determine_greeting(datetime.datetime.now()) + ", sir")
    else:
        alfred.respond("I am Alfred.")

    return jsonify(data)
Exemplo n.º 2
0

def parse_input_for_grammar_tree(text):
    tree = None
    if 'weather' in text or 'temp' in text or 'forecast' in text or 'temperature' in text:
        sent = text.lower()
        sent = sent.split()
        rd_parser = nltk.RecursiveDescentParser(weather_grammar)
        tree = rd_parser.parse(sent)
        get_weather_forecast(tree)
    else:
        print("No Comprende")



alfred.respond("Good afternoon, sir")

alfred.respond("I'm always here for you, sir.")
#while True:
#    inp = input()   # Get the input
#    try:
#        parse_input_for_grammar_tree(inp)
#    except:
#        print("I do not understand the words coming out of your mouth")
#        pass



"""
def parse_for_commands(text):
    pos = language_processor.get_pos(text)