This is a Program which can simulate EMOTIONS and MOOD.
Project description
Introduction
This is a Program which can simulate EMOTIONS and MOOD. It can also generate emotions based on its initial data in its database. The accuracy of generating Emotions get better everytime it learns about a new word or topic. It works by converting the data about a topic to a specific number-sequence according to the other contents and information in its database. Then it extracts the numbers and finds their average, which is the final impression about the word or topic, which will further be stored in its database. The number-sequence is actually code numbers for different emotions. Here is the sequence:
scared : 0
sad : 2
angry : 4
nothing : 5
happy : 6
h-cited : 7
excited : 8
The MOOD however is calculated using the no. of Good emotions and Bad emotions. Here, Good : 10 and Bad : 0 (See code to understand better).
In this case the system is in a good MOOD because majority of the values are 10. _____________________________________________________________ __________________________________
Installation
To use emotions
, you need to have the package installed. Note that if you don't have some packages installed then emotions
will not work, so before installing emotions
, please install the following packages:
!pip install python-firebase
!pip install youtube-transcript-api
!pip install Wikipedia
!pip install google
To install emotions
:
!pip install emotions
Usage
Here are some set of functions to help you use it in your Projects. This module can be very effective for Projects like Personal assistants.
import emotions as aE
: For Importing the module asaE
.aE.learn_info(word,url)
: This function is used to teach the AI about meaning of words. It collects the information from Wikipedia, and if it can't find any it extracts subtitles from YouTube videos, and if the video has no subs, it automatically opens the video and demands for an explanation. Note that if you use this function you don't need to useaE.learn(input, emotion, url)
as emotion is already created by it in the process. If the system doesn't know about any words in the data about theword
, it willprint("I am afraid I don't know any of the words in the data about "+ word)
. If you want to use the information about a word you can use it fromaE.learn_info.ans
oraElearn_info.ans2
(It stores the answer with the sentence: "Did you get your answer?") as per your needs.aE.emotion(ask, url)
: Hereask=
The word you want the AI to react to, andurl=
the url of your Firebase Database(This will be used as the storage). Note that the Mood of AI is independent.aE.learn(input, emotion, url)
: It is used to teach the AI about different words and our feeling about them. Here input refers to the words, emotion refers to the feeling andurl
reffers to the url of the Firebase Database. Once the information is stored it prints'Got it!'
. 'Note that if your firebase database has no bucket'/count'
it will not work. So first go ahead and create a'/count'
and store value0
with tag/1
- To
print()
the out put,print(aE.emotion.mood)
: to print the Mood andprint(aE.emotion.feelings)
: to print the Emotion.
Here is an example, with the link of a public database:
word = 'cake'
url = 'https://knowledge-public.firebaseio.com/'
learn_info(word,url)
print(learn_info.ans)
output:
Cake is a form of sweet food made from flour, sugar, and other ingredients, that is usually baked. In their oldest forms, cakes were modifications of bread, but cakes now cover a wide range of preparations that can be simple or elaborate, and that share features with other desserts such as pastries, meringues, custards, and pies.
The most commonly used cake ingredients include flour, sugar, eggs, butter or oil or margarine, a liquid, and leavening agents, such as baking soda or baking powder. Common additional ingredients and flavourings include dried, candied, or fresh fruit, nuts, cocoa, and extracts such as vanilla, with numerous substitutions for the primary ingredients. Cakes can also be filled with fruit preserves, nuts or dessert sauces (like pastry cream), iced with buttercream or other icings, and decorated with marzipan, piped borders, or candied fruit.Cake is often served as a celebratory dish on ceremonial occasions, such as weddings, anniversaries, and birthdays. There are countless cake recipes; some are bread-like, some are rich and elaborate, and many are centuries old. Cake making is no longer a complicated procedure; while at one time considerable labor went into cake making (particularly the whisking of egg foams), baking equipment and directions have been simplified so that even the most amateur of cooks may bake a cake. (Did you get you answer?)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file emotions-1.2.7-py3-none-any.whl
.
File metadata
- Download URL: emotions-1.2.7-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.1 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e80ca8e1b9e5ca500233598f6238d02e4f1190acd82b9fc4fa174356f5d58dee |
|
MD5 | 32ed6f705beba92d7b88c9a99d8bbf22 |
|
BLAKE2b-256 | f267b20bb6677631fd1bc885fc9cf504543aeb43ed4a72085363999dab43379c |