Using python write a program that create a dictionary as
follows:
data = {'email': ['Click Win Prize', 'Click
meeting setup meeting' ,'Prize free prize ','Click prize
free'],'is_spam': ['yes',
'no','yes','yes'],'bow':['{'click' : 1,'win' :1
,'prize'=1'},{'click' :1 'meeting':2, 'setup':1},{'prize': 2,
'free':1},{'click':1 ,'prize' :1,'free':1}]}
Note that it is equivalent to
Please check well how the dictionary is being used and which
data structure is being used.
Note that you have to find the frequency of all
words(bow) of each emails by coding .Suppose the email and
is_spam data is already given.
Very important: You should not use any libraries. I
showed you in tabular style just for you understand the
logic.
Use the dictionary to calculate the total occurrences of a word
in each Spam and Not Spam class in python.
Thanks.
Out[11]: 0 email is_spam bow click win prize yes {"click": 1, 'win': 1, 'prize': 1} 1 click meeting setup meeting no {"click": 1, "meeting': 2, "setup: 1} prize free prize yes {"prize': 2, 'free': 1} 3 click prize free yes {"click": 1, "prize': 1, 'free': 1) N 3
Using python write a program that create a dictionary as follows: data = {'email': ['Click Win Prize', 'Click meeting se
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am