from api.ai import Agent import json #initialize the agent agent = Agent( '<subscription-key>', '<client-access-token>', '<developer-access-token>', ) # actions defined in the API.AI console that fire locally when an intent is # recognized def saveType(flowerType): print 'do something here' def saveColor(color): print 'do something here' def createOrder(address): print 'do something here' def main(): user_input = '' #loop the queries to API.AI so we can have a conversation client-side while user_input != 'exit': #parse the user input user_input = raw_input("me: ") #query the console with the user input, retrieve the response
from api.ai import Agent import json #initialize the agent agent = Agent( '<subscription-key>', '<7a8781b3255c4780bcf7e383a752fe87>', '<8f9d048c2c504a3db06f813bd6b2bc24>', ) # actions defined in the API.AI console that fire locally when an intent is # recognized def saveType(flowerType): print 'do something here' def saveColor(color): print 'do something here' def createOrder(address): print 'do something here' def main(): user_input = '' #loop the queries to API.AI so we can have a conversation client-side while user_input != 'exit': #parse the user input user_input = raw_input("me: ") #query the console with the user input, retrieve the response response = agent.query(user_input)
import cv2 import subprocess import pyaudio import wikipedia import speech_recognition as sr import webbrowser as wb wake_words = ["wake", "john"] greeting_phrases = [ 'howdy sir', 'whassup sir', "what's up sir", 'hi sir', 'hello sir', 'hey sir' ] agent = Agent( '<subscription-key>', 'd7b00ed0ee08464c860a9f6e8eb7164e', '6fef320b63224ce6a42b443ec8428db1', ) def chat(inp): response = agent.query(inp) result = response['result'] fulfillment = result['fulfillment'] response = fulfillment['speech'] speak(response) def exec_command(command): os.system(command)
import kivy from kivy.app import App from kivy.uix.gridlayout import GridLayout from api.ai import Agent import json #initialize the agent agent = Agent( '<subscription-key>', '9eb285851f6d47a5a1d970e77b16f3de', 'f1d3838773f04e4bb94dc3706a94647e', ) class CalcGridLayout(GridLayout): def __init__(self): super(CalcGridLayout, self).__init__() def API_call(self, user_input): response = agent.query(user_input) result = response['result'] fulfillment = result['fulfillment'] return fulfillment['speech'] class calculatorApp(App): def build(self): return CalcGridLayout() calcApp = calculatorApp()
from flask import Flask, render_template, url_for, redirect, request import os.path, sqlite3 import datetime, time from nltk.stem.wordnet import WordNetLemmatizer import nltk, string, random from api.ai import Agent import json from summary import summary #initialize the agent agent = Agent( 'sakd', '04f67374d4b14ed68d9f13f70ddfdca8', '7b62bcd174784e09ab76acc96be378ed', ) global MedicalFlag, RetrieveRecordsFlag, UpdateRecordsFlag MedicalFlag, RetrieveRecordsFlag, UpdateRecordsFlag, NoRecords = False, False, False, True app = Flask(__name__) def preprocessing(input_text): lst_stop_words = open("stop_words_and_singlish.txt", "r") stop_words = [] for line in lst_stop_words: stop_words.append(''.join(line.strip().split("\n"))) lst_stop_words.close() translator_punc = str.maketrans('', '', string.punctuation) words = input_text.translate(translator_punc) words = words.split()
#etc from packages.etc.memes import get_meme_msg from packages.etc.wisdomsearch import wisdom_search from packages.etc.weather import weather_msg #internal libraries from packages.internal.postbacks import intro_reply, health_reply, bot_menu, subscriptions_reply, current_features_msg MAX_MESSAGE_LENGTH = 640 app = Flask(__name__) app.config.update(SECRET_KEY=os.environ['SECRET_KEY']) agent = Agent( 'thecolumbialion', os.environ['CLIENT_ACCESS_TOKEN'], os.environ['DEVELOPER_ACCESS_TOKEN'], ) page = fbmq.Page(os.environ['ACCESS_TOKEN'], api_ver="v2.11") page.greeting( "Welcome to LionBot! Click below to learn more about what I can do.") page.show_starting_button("GET_STARTED") #THE DICT """ Dictionary of all module interface functions.""" Msg_Fn_Dict = { 'clubs': clubs_msg, 'printers': printers_msg, 'mta_subway_info': mta_subway_info_msg, 'campus_news_updates': news_msg, 'tv_network': tv_network_msg,
import threading from telebot import types from pymongo import MongoClient import traceback import apiai, json from api.ai import Agent token = '' bot = telebot.TeleBot(token) neiro = apiai.ApiAI('') parent = '' agent = Agent( 'cipraded', '', '', ) training = False teachers = [268486177, 792414733, 441399484] @bot.message_handler(commands=['train']) def ctrain(m): pass @bot.message_handler() def txt(m): response = react(m)
from api.ai import Agent import json #initialize the agent agent = Agent( '<subscription-key>', '841d0b494b1c4abbb587f2bddacd87fc', '377275e794464e5cbe74eb66f8ca98b2', ) # actions defined in the API.AI console that fire locally when an intent is # recognized def saveType(flowerType): print 'do something here' def saveColor(color): print 'do something here' def createOrder(address): print 'do something here' def main(): user_input = '' #loop the queries to API.AI so we can have a conversation client-side while user_input != 'exit': #parse the user input user_input = raw_input("me: ") #query the console with the user input, retrieve the response