Skip to content

Commit 8021694

Browse files
authored
Merge pull request hastagAB#29 from umarbrowser/master
Added AIBot
2 parents 7e60734 + 530ae37 commit 8021694

File tree

4 files changed

+102
-0
lines changed

4 files changed

+102
-0
lines changed

Artificial-intelligence_bot/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# What is AI bot>
2+
A chatbot (also known as a talkbot, chatterbot, Bot, IM bot, interactive agent,
3+
or Artificial Conversational Entity) is a computer program or an artificial
4+
intelligence which conducts a conversation via auditory or textual methods.
5+
6+
## How to use it >
7+
Start by Running the below command on your unix terminal or windows CMD
8+
9+
```bash
10+
$ python bash.py
11+
```

Artificial-intelligence_bot/ai.aiml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<aiml version="1.0.1" encoding="UTF-8">
2+
<!-- load.aiml -->
3+
4+
<category>
5+
<pattern>YANE</pattern>
6+
<template>
7+
Ya, kake!
8+
</template>
9+
</category>
10+
11+
<category>
12+
<pattern>WAYE *</pattern>
13+
<template>
14+
<random>
15+
<li>Ni sakagone!</li>
16+
<li>sauri 1000GHZ!</li>
17+
<li>Kwakwalwa 1000PTB!</li>
18+
</random>
19+
</template>
20+
</category>
21+
22+
<category>
23+
<pattern>GASKIYANE *</pattern>
24+
<template>
25+
Kaima kayi daidai! :)
26+
</template>
27+
</category>
28+
29+
<category>
30+
<pattern>YATO *</pattern>
31+
<template>
32+
Komai lafiya
33+
</template>
34+
</category>
35+
36+
</aiml>

Artificial-intelligence_bot/bot.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import sys
2+
try:
3+
import aiml
4+
except ImportError:
5+
print('[!] Failed to import the module')
6+
try:
7+
select = raw_input('[*] Attempt to auto-install aiml? [Y/n')
8+
except KeyboardInterrupt:
9+
print('\n[!] User Cancel')
10+
sys.exit(5)
11+
if select.strip().lower()[0] == 'y':
12+
print('[*] Trying to Install aiml... ')
13+
sys.stdout.flush()
14+
try:
15+
import pip
16+
pip.main(['install', '-q', 'aiml'])
17+
import aiml
18+
print('Finished')
19+
except Exception:
20+
print('Something happens PLease check your internet connection')
21+
sys.exit(5)
22+
23+
elif select.strip().lower()[0] == 'n':
24+
print('[*] User cancel Auto-install')
25+
sys.exit(5)
26+
27+
28+
kern = aiml.Kernel()
29+
kern.learn('load.xml')
30+
kern.respond('load aiml b')
31+
32+
while True:
33+
print(kern.respond(raw_input('Type your Message >>')))

Artificial-intelligence_bot/load.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<aiml version="1.0.1" encoding="UTF-8">
2+
<!-- init.xml -->
3+
4+
<!-- Category is an atomic AIML unit -->
5+
<category>
6+
7+
<!-- Pattern to match in user input -->
8+
<!-- If user enters "LOAD AIML B" -->
9+
<pattern>LOAD AIML B</pattern>
10+
11+
<!-- Template is the response to the pattern -->
12+
<!-- This learn an aiml file -->
13+
<template>
14+
<learn>ai.aiml</learn>
15+
<!-- You can add more aiml files here -->
16+
<!--<learn>more_aiml.aiml</learn>-->
17+
</template>
18+
19+
</category>
20+
21+
</aiml>
22+

0 commit comments

Comments
 (0)