Skip to content

World-Of-Programming-And-Technology/PythonAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python AI

Create AI Brain with PythonAI. Easy to use and opensource.

Install

pip install pythonaibrain

Or,

git clone https://github.com/World-Of-Programming-And-Technology/PythonAI.git
cd PythonAI

Install requirements.

pip install -r requirements.txt

Import Brain From pyai module

from pyai import Brain

How to use it

from 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...

Why Do We Use It.

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.


Way to create 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)

Python AI functions and objects.

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.

Import AdvanceBrain from pyai

You can also use AdvanceBrain in it. It is Advance then Brain class in pyai

How to use AdvanceBrain.

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...

How to create intents.json file.

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)

About

Make your first AI Assistant in Python with just an intents.json file. No complex setup. No advanced coding. Just install, configure, and run!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors