Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save harendra21/629e2274a5972b08c5d63fbbb7e63210 to your computer and use it in GitHub Desktop.
Save harendra21/629e2274a5972b08c5d63fbbb7e63210 to your computer and use it in GitHub Desktop.
import sys
try:
import aiml
except ImportError:
print('[!] Failed to import the module')
try:
select = raw_input('[*] Attempt to auto-install aiml? [Y/n')
except KeyboardInterrupt:
print('\n[!] User Cancel')
sys.exit(5)
if select.strip().lower()[0] == 'y':
print('[*] Trying to Install aiml... ')
sys.stdout.flush()
try:
import pip
pip.main(['install', '-q', 'aiml'])
import aiml
print('Finished')
except Exception:
print('Something happens PLease check your internet connection')
sys.exit(5)
elif select.strip().lower()[0] == 'n':
print('[*] User cancel Auto-install')
sys.exit(5)
kern = aiml.Kernel()
kern.learn('load.xml')
kern.respond('load aiml b')
while True:
print(kern.respond(raw_input('Type your Message >>')))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment