Create AI Brain with PythonAI. Easy to use and opensource.
pip install pythonaibrainOr,
git clone https://github.com/World-Of-Programming-And-Technology/PythonAI.gitcd PythonAIInstall requirements.
pip install -r requirements.txtfrom pyai import Brainfrom os import system
from pyai import Brain
brain = Brain("your/dataset/path/intents.json") # Enter Path of your dataset.
while True:
message = input('Message : ')
message_type = brain.predict_message_type(message)
if message_type == 'Question' or message_type == "Answer":
brain.pyai_say(brain.process_messages(message))
if message_type == "Shutdown":
system(message)And So on...
It can help you to perform AI projects based on NLP (Nature Language Processing), ML (Mechine Learning) and DL (Deep Learning).
You can also make your own AI Assistance with it. Give Data in intents.json file.
{
"intents" :[
{
"tag" : "gretting",
"patterns" : ["Hi", "Hello", "Hey"],
"responses": ["Hi, How can I assist you today", "Hey there"]
},
{
"tag" : "gretting",
"patternss" : ["Hi", "Hello", "Hey"],
"response": ["Hi, How can I assist you today", "Hey there"]
},
]
}In this way you can create your intents.json file. If you want you can add more data also.
Add in this formate only, otherwise program will through an error. (Remember)
| Function And Object Name | Description |
|---|---|
| Brain | It is an object to create Barin by passing intents.json file |
| AdvanceBrain | It also create Barin by passing intents.json file, but it is advance then Brain object. |
| pyai_say | It is a function inside Brain class to print the answer of the given question. |
| predict_message_type | It is use to predict the type of questions Like the message in question format or answer or command or start or shutdown. |
| predict_entities | It stract name, age and location form the given message. |
You can also use AdvanceBrain in it. It is Advance then Brain class in pyai
from pyai import AdvanceBrain
advance_brain = AdvanceBrain('your/dataset/path/intents.json')
while True:
message = input('Message : ')
message_type = advance_brain.predict_message_type(message) # It predict the message type.
if message_type == "Question" or message_type == "Answer":
advance_brain.pyai_say(advance_brain.process_messages(message)) # It can process the input message and print the output.And so no...
The same process
{
"intents" :[
{
"tag" : "gretting",
"patterns" : ["Hi", "Hello", "Hey"],
"responses": ["Hi, How can I assist you today", "Hey there"]
},
{
"tag" : "gretting",
"patternss" : ["Hi", "Hello", "Hey"],
"response": ["Hi, How can I assist you today", "Hey there"]
},
]
}Add in this formate only, otherwise program will through an error. (Remember)