mirror of
https://github.com/hastagAB/Awesome-Python-Scripts.git
synced 2025-03-20 20:49:47 +00:00
commit
80216947cb
11
Artificial-intelligence_bot/README.md
Normal file
11
Artificial-intelligence_bot/README.md
Normal file
@ -0,0 +1,11 @@
|
||||
# What is AI bot>
|
||||
A chatbot (also known as a talkbot, chatterbot, Bot, IM bot, interactive agent,
|
||||
or Artificial Conversational Entity) is a computer program or an artificial
|
||||
intelligence which conducts a conversation via auditory or textual methods.
|
||||
|
||||
## How to use it >
|
||||
Start by Running the below command on your unix terminal or windows CMD
|
||||
|
||||
```bash
|
||||
$ python bash.py
|
||||
```
|
36
Artificial-intelligence_bot/ai.aiml
Normal file
36
Artificial-intelligence_bot/ai.aiml
Normal file
@ -0,0 +1,36 @@
|
||||
<aiml version="1.0.1" encoding="UTF-8">
|
||||
<!-- load.aiml -->
|
||||
|
||||
<category>
|
||||
<pattern>YANE</pattern>
|
||||
<template>
|
||||
Ya, kake!
|
||||
</template>
|
||||
</category>
|
||||
|
||||
<category>
|
||||
<pattern>WAYE *</pattern>
|
||||
<template>
|
||||
<random>
|
||||
<li>Ni sakagone!</li>
|
||||
<li>sauri 1000GHZ!</li>
|
||||
<li>Kwakwalwa 1000PTB!</li>
|
||||
</random>
|
||||
</template>
|
||||
</category>
|
||||
|
||||
<category>
|
||||
<pattern>GASKIYANE *</pattern>
|
||||
<template>
|
||||
Kaima kayi daidai! :)
|
||||
</template>
|
||||
</category>
|
||||
|
||||
<category>
|
||||
<pattern>YATO *</pattern>
|
||||
<template>
|
||||
Komai lafiya
|
||||
</template>
|
||||
</category>
|
||||
|
||||
</aiml>
|
33
Artificial-intelligence_bot/bot.py
Normal file
33
Artificial-intelligence_bot/bot.py
Normal file
@ -0,0 +1,33 @@
|
||||
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 >>')))
|
22
Artificial-intelligence_bot/load.xml
Normal file
22
Artificial-intelligence_bot/load.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<aiml version="1.0.1" encoding="UTF-8">
|
||||
<!-- init.xml -->
|
||||
|
||||
<!-- Category is an atomic AIML unit -->
|
||||
<category>
|
||||
|
||||
<!-- Pattern to match in user input -->
|
||||
<!-- If user enters "LOAD AIML B" -->
|
||||
<pattern>LOAD AIML B</pattern>
|
||||
|
||||
<!-- Template is the response to the pattern -->
|
||||
<!-- This learn an aiml file -->
|
||||
<template>
|
||||
<learn>ai.aiml</learn>
|
||||
<!-- You can add more aiml files here -->
|
||||
<!--<learn>more_aiml.aiml</learn>-->
|
||||
</template>
|
||||
|
||||
</category>
|
||||
|
||||
</aiml>
|
||||
|
Loading…
x
Reference in New Issue
Block a user