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)
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. '''