Python Forum
Impact of words from sentence on popularity
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Impact of words from sentence on popularity
#1
Hi, I have a table with few thousand of rows, in one column is a one or few sentences of joke, in second number of views. I would like to sort words which are mostly used in best jokes but not in bad one and reverse. How to do it in Python? Thank you
Reply
#2
Quote:How to do it in Python?
Please show what have you tried?
Reply
#3
Yes, code please :-D
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#4
Sure, I have to say, that I'm stucked just at the start now I'm able to get only whole sentences, and their occurences.
df = pd.read_csv('C:/Users/Adam/School/6th semester/project/dataset.csv')
df['text'].value_counts()
df_test = df.query('text == "test sentence"')
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 2827 entries, 0 to 2826
Data columns (total 2 columns):
 #   Column         Non-Null Count  Dtype  
---  ------         --------------  -----  
 0   File           2827 non-null  object 
 1   text	        2827 non-null  object 
 3   views          2827 non-null  int64
Reply
#5
I make some progress!

oneList = list(df['text'])
oneString = ' '.join(oneList)
allWords = oneString.lower().split()
count = Counter(allWords)
print(count)
now I'm able to get frequency of words, but unfortunately without the influence of popularity :/

Any ideas how to distinguish between popular and unpopular? Thanks!
Reply
#6
Quote:Any ideas how to distinguish between popular and unpopular? Thanks!

I think you will need NLTK's frequency distribution functions or something similar.

Here's a few places to research:
http://www.nltk.org/api/nltk.html?highli...robability
https://python.gotrained.com/frequency-d...n-in-nltk/
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to find the impact of each of the correlated features? AlekseyPython 0 1,415 Sep-28-2021, 09:05 AM
Last Post: AlekseyPython
  Analysing impact of insider sales Anonymushacker8 0 1,434 Apr-30-2020, 03:11 PM
Last Post: Anonymushacker8
  Can python detect style of language? eg. Flowery words vs simple words mcp111 4 2,441 Jan-07-2020, 02:25 PM
Last Post: mcp111

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020