Halaal, before going deep dive into the session, let's have a quick recap of what we have done in
our previous session.
So we have basically read our data using this ESKIL database very first.
We have established our connection to the database.
Then using this read as Calgary, we have successfully read the data from this table and using our online
compiler, we all get to know ya.
This is exactly the table that is available inside that database.
So after eight, we have also readable data using our real key function, which is exactly.
Let me show that.
Yeah.
Which is exactly this one.
So if you will ask my advice, I will always advise you to go through with this database approach.
So in this session we have this assignment.
The very first statement we have to deal with that is exactly we have to perform sentiment analysis
on our data.
So what exactly is sentiment analysis?
So sentiment analysis is all about determining what feelings a particular person has, let's say, and
saying, yeah, that celebrity looks awesome.
It means I have a positive sentiment for that particular celebrity.
Same thing.
Yeah, that guy is ugly.
It means I have a negative sentiment for that particular guy that I'm seeing.
This Coffey's average not not that much good.
Not not that much bad.
So it means I have a neutral sentiment for that coffee.
So that's all about that.
That's the idea behind what exactly is sentiment analysis.
So with respect to data, you have to perform your sentiment analysis.
It means with respect to the summary column, you have to perform this sentiment analysis so that if
you need some external libraries to perform this sentiment analysis, because writing code from scratch
will definitely very complex over here.
So Python gives that functionality so that we don't have to write that much huge number of lines to
perform sentiment analysis so that if us to have to install our external model, which is exactly my
text blob's, I'm going to say install or text blob.
So if you haven't install it, just install using the blocks of code.
Now after what you have to do, you have to just import this tax block.
So I'm going to say from this text block module, you have to import a class which is exactly my text
got class, so I'm just going to say import my text blob class, just BASTABLE over here.
And it is exactly that class.
Now, what you have to do, let's say let me show the thing.
Let's say I'm just going to say deal of summary, summary of zero.
So if let's say if I'm going to print it, you will see this is exactly the very first summary given
by my user, given by my some customer.
And let's say I have to perform sentiment analysis on this particular text.
See, I'm just going to store it in my text.
And if I were to print it, that's not a fancy task.
Now you have to perform sentiment analysis using this class.
So I'm just going to say I have to pass this text in my tax law.
And on this, I have to call my sentiment dot polarity because we have to state what exactly the popularity
of that particular sentiment, whether it is plus one, minus one or between plus one to minus one or
zero, because plus one definitely indicates, yeah, it's a positive polarity or you can see it's positive
sentiment, whereas zero refers to my neutral sentiment, minus one refers to my negative sentiment
just executed even though it has that much sentiment.
Yeah, it means it seems to have a very positive sentiment with respect to this particular summary.
So it means you have to perform the sentiment analysis with respect to each and every summary.
So I'm just going to say very first, I have to define a blank list, which is exact polarity.
So whatever polarity I will get with respect to each and every summary, I'm just going to restore in
this list.
After what I have to do, I have to just as for I in deal of summary.
So I have to just as this one.
Now I'm going to say on each and every I am just going to say very first I have to exit this test block
and in this I have to pass my this I and on these I'm going to say dot sentiment, dot polarity.
Then whatever polarity it will be, I'm just going to find in this.
At least that said, that's what that's what is our best way to find sentiment analysis on your data.
But there is a hack.
What if what if I have some missing values in my data for this?
What I can do, I can write these blocks of code in my tribe block.
So here I going to say it is my try block and whatever exception will come that will get handed by basically
you except block.
So here I am going to say very first I have to write my blog and here I have to say whenever there is
some exception.
So in such case you have to just append zero in your list.
I'm just going to append to in my list, make sure you have proper indentation.
Otherwise the Salta lots of time at it will give my some improper conclusion.
So make sure you have this proper indentation over here and over here.
So just executer, it will be somewhere around one to two minutes depending upon what the specifications
you have now.
You will figure out your you Celldex executed.
And if I'm going to calculate the length of my polarity, then you will see over here it has that muslum.
Just see one here, how much complex data we have, because whenever you are going to work on some real
one aspect, you always have that much use it.
You don't have those data and some say some hundred rows, some thousand.
You never had that much data.
So now what we have to do, we have to insert this polarity in my data frame.
So I'm just going to say, let's say very close.
I'm just going to create a copy of my data frame.
And in this I'm going to say I'm just going to store it in this D.F. or I can see data and after it,
what I have to do if I'm going to define a new column in my this data frame, which is exactly polarity.
And here I have to assign this polarity as well.
That's it.
And make sure if I'm going to execute it and if I'm going to call, I had a word you will figure out
a new column with polarity that contains polarity with respect to each and every summary has been added
in.
So that is exactly what sentiment analysis with respect to the summary column, in a similar way, you
can perform sentiment analysis with respect to this text column as well.
It's all up to you.
So let's go ahead with our NextRadio statement, the second one in which I have to perform exploratory
analysis, which is easier for the positive sentences.
So here I'm just going to say wherever polarity will be greater than zero.
That is exactly my positive sentence.
So here I will say that if I have a defined filter, which is exactly data of polarity, must be greater
than zero, must be greater than zero.
This is exactly my filter.
I had to just pass this filter in my data so that I will have my full to say I'm just going to store
it somewhere.
So this is exactly my data underscore positive, just executed and ifs in this data and it's so positive,
a fine way to call shape or you will see that huge amount of data.
Now let's say you have to perform your exploratory analysis on this data, on the positive data frame.
It means you have to figure out you're in the summary column.
In this summary column.
What are those keywords on which user is going to focus on?
Or you can say what are those keywords on which user is going to emphasize?
So whenever you have that scenario where you have huge chunk of data and from that huge chunk of data,
you have to extract some popular keywords in such scenarios, always go ahead with your word cloud.
So what exactly is word for word?
Cloud will always reflect those words that has a higher priority in data.
So here I'm just going to say very first, if you haven't installed in the cloud so you guys can simply
install using this install word cloud.
So I have already installed it.
So it makes no sense at all to install it again.
So now from this word cloud module, I'm going to say I have to import my word cloud and I have to import
something else, which is exactly my word.
So what exactly are stored words like the hishe it they then his him.
Her.
So these are exactly my strong words because it makes no sense at all in your analysis.
So just execute it.
Now what we have to do, we have to create a unique Stallworth's.
So I'm just going to say I just need my unique Stallworth's now.
I'm just going to call a set on this because.
Providing my uniqueness, let's say I'm just going to store it somewhere else, like, say, store it
in stores, just execute it now.
Now, what I'm going to do and let's see if on this stage and it's to the I'm just going to call ahead
to get a preview of my date of frame.
You will see this is exactly my summary column, Lexcen.
I need I need the entire data of this summary column.
So for this, we can join this column.
So far, this is what I'm going to do.
I'm just going to say I have to join this summary column here.
I'm going to use my joint.
And very first, I have to access my data, underscore positive.
And in this, I have to access this summary.
Let's say after doing Jan, you have to store it, say, somewhere else.
So here I'm just going to say let's say I have to store it in total text.
It's all up to you, whatever, whatever name you want to assign.
And after it, what I'm going to do now, I'm just going to execute.
It will take some couple of seconds, get executed successfully.
And if I'm going to call a line over there now, you will figure out what exactly the total and look
at it, how much huge amount of data you have.
And let's see if you have to print some first ten thousand so you guys can print using this zero to
ten thousand, you will see this is that cost ten thousand worth of this total text string.
Findus use it, you will figure it out.
You have this dot and some special characters as well.
It means you have to remove all these things.
So now what I am going to do, I'm just going to say I have two very first import my regular expression
module that will highly helpful for us whenever we have to deal with our text it Aleksa whenever we
have to clean our texada or whenever we have to do some modification or text data.
So always go ahead with this added module.
So here what I am going to do and it's going to call my sub, which is exactly my substitute function
in this module.
And here I am going to say, oh, except A to Z and capitally to that, whatever we have just eliminated.
So for this I'm going to say, except you have to use this operator A to Z and capitally to that as
well.
So capitally does it.
So whenever you have this, just replace it with some Espace.
That's what this substitute function will do.
Then you have to tell on what data you have to perform this operation.
So I have to perform this operation on total Alesco text.
Let's say I have to update it as well.
So I'm just going to update you using this.
Just execute it.
It will take some couple of seconds.
Now, this blocks of code gets successfully executed over here.
And if I say I'm going to print this total underscore text, let's say I have to print my host.
Twenty thousand.
It's all up to know.
You will figure out over here.
Now you have some extra spaces.
Look at here.
You have some extra spaces.
It means it's still you have to clean this data.
See, whenever you are going to work from some real world aspect, almost 70 to 80 percent of your total
time will get spent and you are cleaning and in your data privacy.
So always be patient.
Now we have to remove this access space.
So for this, I'm going to say it, Audie, dot substitute.
And this time I have to remove wherever I have more than one extra spaces.
I have to remove it with one extra space.
So this is that way of writing it.
Then I have to say on what data I have to perform this.
So basically on total in this context, then I am going to say I have to update it as well.
So just execute it.
It will take some couple of seconds.
Now, if now I'm going to actually print my first ten thousand, now you will see you don't have any
extra spaces in this data.
So you are up to some extent you data somehow already you still you have some dirtiness in your data,
but that's okay.
So now what you can do, you can easily create word cloud of this huge chunk of data, because from
this huge chunk of data you need some those highlighted given that has some higher priority.
So what I'm going to do, I'm just going to initialize my workflow, which is exactly this one.
Here you have all your custom parameters.
Look at that.
What is your rate?
What is your height and what are your all these things?
What are your top words and all these different different things.
So let's say I have to agenda.
Workload having my own specification, so here I'm going to say let's say I want which sage of like
say a thousand and after it I want pyt of like say five hundred.
Then in this Stallworth's I have to mention mine is doverton that I have created earlier.
Know what you have to do using this generate.
You have to generate your workload and here you have to pass your total on the score text.
Let's say I have to store it somewhere else.
Let's say I'm going to store it in a word cloud.
This is exactly my cloud.
Now, what you have to do, let's say I have to set my own secure site.
So here I am with the safety altitude figger fixie age of 15.
Come on, let's say 15.
Five is exactly my Vinda site in which my word cloud is going to be represented over here.
Now I have to showcase this world using this I am sure function.
And here I have to mention my word cloud, which is exactly this one.
And if I'm going to execute it, it will take some couple of seconds over here.
So this is exactly that word.
But you will see if you still have some access so you can disable this access using this particular
axis, bypassing of parameter again executed.
It will again take some couple of seconds to from this word cloud.
If you have to conclude something, you will figure out this delicious love good fast.
And there are many such key words that are highly prioritized.
It means users are going to focus on these words.
It means most of the time users are going to use these words in a similar way.
You can perform all this analysis, all this analysis for your negative sentiment as well as in the
upcoming session.
We are going to deal with this statement and many other problems statement as well.
Hope you love this session very much.
Thank you, guys.
How nice to keep learning.
Keep growing, keep motivated.