コード例 #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)
コード例 #2
0
__author__ = 'matt.livingston'

from speech.alfred_speech import AlfredSpeech
from utils.language import Core
from weather_services import weather
import nltk
from nltk import load_parser

print('Initializing Speech Engine')
alfred = AlfredSpeech()
language_processor = Core()

print('Loading Grammar Models')
weather_grammar = nltk.data.load('file:/config/simple_weather.cfg')
#text = "What is the weather?"
#d = language_processor.get_pos(text)


#cp = load_parser('/config/weather.fcfg')
# query = 'What cities are in China'
# trees = list(cp.parse(query.split()))

#for t in trees:
#    print(t)

#text = "What is the weather"
#text = "What is the current temp"
#text = "What is the current temperature"
#text = "What is tomorrow's forecast"
#text = "What will the weather be like tomorrow"
#tagged_text = language_processor.get_pos(text)