Exemplo n.º 1
0
    def __init__(self):
        self.BOT_PREDICATES = {
            "name": "KanoBot",
            "birthday": "January 1st 1969",
            "location": "London",
            "master": "Judoka",
            "website": "https://github.com/brandonjackson/make-chatterbot",
            "gender": "",
            "age": "",
            "size": "",
            "religion": "",
            "party": ""
        }

        self.DEVNULL = open(os.devnull, 'wb')

        self.k = MyKernel()

        # Load the AIML files on first load, and then save as "brain" for speedier startup
        if os.path.isfile("cache/standard.brn") is False:
            self.k.learn("aiml/standard/std-startup.xml")
            self.k.respond("load aiml b")
            self.k.saveBrain("cache/standard.brn")
        else:
            self.k.loadBrain("cache/standard.brn")

        # Give the bot a name and lots of other properties
        for key, val in self.BOT_PREDICATES.items():
            self.k.setBotPredicate(key, val)
Exemplo n.º 2
0
if args.engine:
    TTS_ENGINE = args.engine

# Make sure espeak exists
if TTS_ENGINE == "espeak":
    try:
        subprocess.call(["espeak","-q","foo"])
    except OSError:
        TTS_ENABLED = False
        print "Warning: espeak command not found, skipping voice generation"
else:
    # non-espeak TTS engine being used
    pass

# Create Kernel (using our custom version of the aiml kernel class)
k = MyKernel()
 
# Load the AIML files on first load, and then save as "brain" for speedier startup
if os.path.isfile("cache/standard.brn") is False: #FIXME undo this. 
    k.learn("aiml/std-startup.xml")
    k.respond("load aiml b")
    k.saveBrain("cache/standard.brn")
else:
    k.loadBrain("cache/standard.brn")
 
# Give the bot a name and lots of other properties
for key,val in BOT_PREDICATES.items():
    k.setBotPredicate(key, val)

# Init STT engine
recognizer = sr.Recognizer()
Exemplo n.º 3
0
grade_codes = ["ap","aa","ab","bb","bc","cc","cd","dd","dx","fr"]

BOT_INFO = {
    "name": "Black Dragon",
    "birthday": "October 20th 2015",
    "location": "Mumbai",
    "master": "Houdini III",
    "website":"https://moodle.iitb.ac.in",
    "gender": "Male",
    "age": "20",
    "size": "",
    "religion": "Hindu",
    "party": "Oh yes,of course anytime!"
}

k = MyKernel()
k.learn("aiml/standard/std-startup.xml")
k.respond("LOAD AIML B")

for key,val in BOT_INFO.items():
	k.setBotPredicate(key,val)

class PopupBox(ModalView):
    '''
    :Events:
        `on_open`:
            Fired when the Popup is opened.
        `on_dismiss`:
            Fired when the Popup is closed. If the callback returns True, the
            dismiss will be canceled.
    '''
Exemplo n.º 4
0
grade_codes = ["ap","aa","ab","bb","bc","cc","cd","dd","dx","fr"]

BOT_INFO = {
    "name": "Amanda",
    "birthday": "July 5th 2017",
    "location": "Kanpur",
    "master": "I have no Master",
    "website":"follow me on twitter",
    "gender": "Female",
    "age": "20",
    "size": "",
    "religion": "Humanity",
    "party": "All night !"
}

k = MyKernel()
k.learn("aiml/standard/std-startup.xml")
k.respond("LOAD AIML B")

for key,val in BOT_INFO.items():
	k.setBotPredicate(key,val)

class PopupBox(ModalView):
    '''
    :Events:
        `on_open`:
            Fired when the Popup is opened.
        `on_dismiss`:
            Fired when the Popup is closed. If the callback returns True, the
            dismiss will be canceled.
    '''
Exemplo n.º 5
0
grade_codes = ["o", "a+", "a", "b+", "b", "c+", "c", "d+", "d", "f"]

BOT_INFO = {
    "name": "College Information Assistant (CIA)",
    "birthday": "Oct 15th 2018",
    "location": "DTU",
    "master": "DTU Administration",
    "website": "follow me on facebook",
    "gender": "Female",
    "age": "21",
    "size": "",
    "religion": "Humanity",
    "party": "All semester !"
}

k = MyKernel()
k.learn("aiml/standard/std-startup.xml")
k.respond("LOAD AIML B")

for key, val in BOT_INFO.items():
    k.setBotPredicate(key, val)

import pymysql
import base64
import getpass

connection = pymysql.connect(
    host='localhost',
    user='******',
    password='******',
    db='dtu_bot',
Exemplo n.º 6
0
class ChitChat(object):
    def __init__(self):
        self.BOT_PREDICATES = {
            "name": "KanoBot",
            "birthday": "January 1st 1969",
            "location": "London",
            "master": "Judoka",
            "website": "https://github.com/brandonjackson/make-chatterbot",
            "gender": "",
            "age": "",
            "size": "",
            "religion": "",
            "party": ""
        }

        self.DEVNULL = open(os.devnull, 'wb')

        self.k = MyKernel()

        # Load the AIML files on first load, and then save as "brain" for speedier startup
        if os.path.isfile("cache/standard.brn") is False:
            self.k.learn("aiml/standard/std-startup.xml")
            self.k.respond("load aiml b")
            self.k.saveBrain("cache/standard.brn")
        else:
            self.k.loadBrain("cache/standard.brn")

        # Give the bot a name and lots of other properties
        for key, val in self.BOT_PREDICATES.items():
            self.k.setBotPredicate(key, val)

# Start Infinite Loop

    def chat(self, sentence):
        # Prompt user for input
        #     input = raw_input("> ")
        input = sentence
        # Send input to bot and print chatbot's response
        matchedPattern = self.k.matchedPattern(
            input)  # note: this has to come before the
        # call to respond as to reflect
        # the correct history
        response = self.k.respond(input)
        return response
Exemplo n.º 7
0
if args.engine:
    TTS_ENGINE = args.engine

# Make sure espeak exists
if TTS_ENGINE == "espeak":
    try:
        subprocess.call(["espeak", "-q", "foo"])
    except OSError:
        TTS_ENABLED = False
        print "Warning: espeak command not found, skipping voice generation"
else:
    # non-espeak TTS engine being used
    pass

# Create Kernel (using our custom version of the aiml kernel class)
k = MyKernel()

# Load the AIML files on first load, and then save as "brain" for speedier startup
if os.path.isfile("cache/standard.brn") is False:
    k.learn("aiml/standard/std-startup.xml")
    k.respond("load aiml b")
    k.saveBrain("cache/standard.brn")
else:
    k.loadBrain("cache/standard.brn")

# Give the bot a name and lots of other properties
for key, val in BOT_PREDICATES.items():
    k.setBotPredicate(key, val)

# Start Infinite Loop
while True:
Exemplo n.º 8
0
if args.engine:
    TTS_ENGINE = args.engine

# Make sure espeak exists
if TTS_ENGINE == "espeak":
    try:
        subprocess.call(["espeak", "-q", "foo"])
    except OSError:
        TTS_ENABLED = False
        print "Warning: espeak command not found, skipping voice generation"
else:
    # non-espeak TTS engine being used
    pass

# Create Kernel (using our custom version of the aiml kernel class)
k = MyKernel()

# Load the AIML files on first load, and then save as "brain" for speedier startup
if os.path.isfile("brain.brn") is False:
    k.learn("inizializzazione.xml")
    k.respond("load aiml b")
    k.saveBrain("brain.brn")
else:
    k.loadBrain("brain.brn")

# Give the bot a name and lots of other properties
for key, val in BOT_PREDICATES.items():
    k.setBotPredicate(key, val)

# Start Infinite Loop
while True: