SHARE
TWEET

Untitled

a guest Aug 25th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # knowledge
  2. know = {}
  3.  
  4. # sense estimulation
  5. heard = input("What do you want to do? ")
  6.  
  7. # naming filename
  8. def create_filename(name):
  9.     return name.replace(' ', '_') + '.json'
  10.  
  11. # naming classname
  12. def create_class_name(name):
  13.     subnames = []
  14.     if ' ' in name:
  15.         subnames = [subname.capitalize() for subname in name.split()]
  16.         return "".join(subnames)
  17.     return name.capitalize()
  18.  
  19. # saving model in memory database
  20. def create_json_class():
  21.     print('Creating class JSON')
  22.     # stimulus to create a new word associated with the need for current memory
  23.     name = input('What name do I give the class? ')
  24.     # saving model in database
  25.     with open(create_filename(name), 'w+') as f:
  26.         f.write(str({
  27.             'name': create_class_name(name),
  28.             'statics': [],
  29.             'attributes': [],
  30.             'methods': []
  31.         }))
  32.         f.close()
  33.     print('class JSON created')
  34.     return True
  35.  
  36. # rendering idealized model
  37. def create_file_class():
  38.     print('Creating file of class')
  39.     return True
  40.  
  41. # memory indexing of "create class" sequence actions
  42. class Event:
  43.     def __init__(self):
  44.         self.__eventhandlers = []
  45.     def __iadd__(self, handler):
  46.         self.__eventhandlers.append(handler)
  47.         return self
  48.     def __isub__(self, handler):
  49.         self.__eventhandlers.remove(handler)
  50.         return self
  51.     def __call__(self, *args, **keywargs):
  52.         for eventhandler in self.__eventhandlers:
  53.             eventhandler(*args, **keywargs)
  54.  
  55. memory_create_class = Event()
  56. memory_create_class += create_json_class
  57. memory_create_class += create_file_class
  58.  
  59. # knowledge indexing
  60. know['create_class'] = memory_create_class
  61.  
  62. # converting words in knowledge indexing
  63. understood = heard.replace(" ", "_")
  64.  
  65. # accessing knowledge indexing for searching words
  66. if understood in know:
  67.     interpreted = know[understood]
  68.     # verifing knowledge memory
  69.     interpreted()
  70.     #for memory in interpreted:
  71.         # executing knowledge actions
  72.         #memory() if callable(memory) else None
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top