TITLE: The public attitude towards ChatGPT on Reddit:  A study based on unsupervised learning from sentiment analysis and topic modeling
AUTHORS: Zhaoxiang Xu, Mingjian Xie, Yanbo Huang, Qingguo Fang

[DESCRIPTION]
Our code has THREE main parts:

Data Processing: In terms of data cleaning, for the textual data in the database, special characters, punctuation, links, and unnecessary words were removed from the comment texts. This study applied lowercase conversion (removing uppercase letters) and removed stopwords. The NLTK library provides the English stopword list. It consists of common English words with no semantic or informational value and is typically filtered out in natural language processing to enhance the efficiency and accuracy of text analysis. Stopwords play a crucial role in enhancing text feature quality and reducing the significance of text features. Considering a slight overlap in the data sources, this study also conducted duplicate text filtering. In the end, 23,773 entries were retained, forming the database Processed_GPT_total.json.

Sentiment Analysis: The analyzed entries exceeded a total count of 23,773 entries. The two sentiment analysis models, Vader and Textblob, are assigned weights of 0.6 and 0.4 for sentiment classification. The sentiment analysis categorizes the emotional tone of the entries into three distinct parameters: positive, negative, and neutral. This study did histograms and emoji wordclouds of different emotions for analysis.
Based on the GPT-3.5 model, ChatGPT was launched by Open AI on November 30, 2022, gaining a growing user base. On March 15, 2023, OpenAI unveiled the new large-scale multimodal model, GPT-4, available for purchase. This study examines daily sentiment trends by comparing the quantity of positive and negative sentiment posts from January to August 2023 (N=23,773). It aims to ascertain whether version updates and evolution have influenced sentiment towards ChatGPT.

Topic modeling: The topic modeling addresses the research question: What are the emerging topics related to ChatGPT? The LDA model could help determine the most suitable number of topics for classification. The topic modeling is performed with LDA, and the perplexity-topic number curve is plotted. Subsequently, the results for each number of topics are analyzed to identify the optimal number of topics based on the highest topic coherence.

[STEPS]
SECTION: Import Packets &amp; Data Preparation
1. 
 
The 4 files below are the processed datasets (with the keywords GPT3.0, GPT3.5, GPT4.0 with the full sample files)
        

The following 3 files are the original files (with keywords GPT3.0, GPT3.5 & GPT4.0)
      

SECTION: Data Processing
2. Data Balancing
 

Data Merging (GPT3.0, GPT3.5, GPT4.0)
 

Data Cleaning
 


SECTION: Word Frequency
3. Word frequency bar graph display for GPT_total.json
 

 

SECTION: Sentiment Analysis
4. Sentiment classification (bar chart)
 

 
Sentiment classification (pie chart)

 

 

Changes in Positive and Negative Emotions over Time
 

 


SECTION: Topic Modeling
5. LDA topic modeling and plotting perplexity-topic curves

 

 

 
[(0,
  '0.014*"like" + 0.010*"people" + 0.009*"think" + 0.008*"would" + 0.008*"get" '
  '+ 0.008*"even" + 0.006*"use" + 0.006*"time" + 0.006*"much" + 0.006*"good"'),
 (1,
  '0.064*"bot" + 0.023*"please" + 0.022*"prompt" + 0.021*"link" + 0.019*"open" '
  '+ 0.013*"questions" + 0.013*"amp" + 0.013*"message" + 0.012*"action" + '
  '0.011*"free"'),
 (2,
  '0.019*"consciousness" + 0.015*"conscious" + 0.010*"agi" + 0.008*"humans" + '
  '0.008*"brain" + 0.007*"god" + 0.007*"human" + 0.007*"believe" + '
  '0.006*"intelligence" + 0.005*"self"'),
 (3,
  '0.010*"like" + 0.008*"code" + 0.008*"use" + 0.007*"would" + 0.007*"prompt" '
  '+ 0.006*"text" + 0.005*"data" + 0.005*"language" + 0.005*"also" + '
  '0.005*"make"'),
 (4,
  '0.009*"man" + 0.006*"music" + 0.005*"art" + 0.005*"state" + 0.005*"top" + '
  '0.004*"health" + 0.004*"home" + 0.004*"quantum" + 0.004*"menu" + '
  '0.004*"fire"'),
 (5,
  '0.008*"amp" + 0.008*"world" + 0.005*"market" + 0.004*"people" + '
  '0.004*"life" + 0.004*"human" + 0.004*"game" + 0.004*"new" + 0.003*"jobs" + '
  '0.003*"impact"'),
 (6,
  '0.005*"gif" + 0.005*"admit" + 0.004*"giphy" + 0.004*"wide" + 0.004*"care" + '
  '0.003*"forgot" + 0.003*"trump" + 0.003*"president" + 0.003*"capital" + '
  '0.002*"spider"')]

 
[(0,
  '0.015*"link" + 0.009*"lmao" + 0.006*"fire" + 0.006*"years" + '
  '0.005*"windows" + 0.005*"coal" + 0.005*"range" + 0.005*"countries" + '
  '0.005*"waiting" + 0.005*"air"'),
 (1,
  '0.023*"consciousness" + 0.006*"care" + 0.006*"universe" + '
  '0.006*"intelligence" + 0.006*"awareness" + 0.005*"life" + 0.005*"dumber" + '
  '0.004*"self" + 0.004*"humans" + 0.004*"women"'),
 (2,
  '0.015*"like" + 0.009*"would" + 0.009*"think" + 0.009*"people" + '
  '0.008*"even" + 0.006*"data" + 0.006*"time" + 0.006*"way" + 0.005*"know" + '
  '0.005*"good"'),
 (3,
  '0.058*"bot" + 0.032*"open" + 0.024*"source" + 0.024*"please" + '
  '0.024*"prompt" + 0.016*"amp" + 0.015*"message" + 0.015*"openai" + '
  '0.014*"questions" + 0.014*"image"'),
 (4,
  '0.014*"use" + 0.013*"code" + 0.010*"api" + 0.009*"prompt" + 0.009*"chat" + '
  '0.008*"get" + 0.008*"like" + 0.007*"text" + 0.006*"answer" + 0.006*"also"'),
 (5,
  '0.009*"market" + 0.005*"impact" + 0.005*"content" + 0.005*"gpu" + '
  '0.004*"trade" + 0.004*"government" + 0.004*"nvidia" + 0.003*"voice" + '
  '0.003*"apple" + 0.003*"cost"'),
 (6,
  '0.009*"amp" + 0.005*"new" + 0.005*"pay" + 0.005*"company" + 0.004*"people" '
  '+ 0.004*"game" + 0.004*"world" + 0.004*"help" + 0.004*"story" + '
  '0.003*"business"'),
 (7,
  '0.005*"wolfram" + 0.005*"electric" + 0.004*"sample" + 0.004*"censored" + '
  '0.003*"didnt" + 0.003*"repetition" + 0.003*"para" + 0.003*"sin" + '
  '0.003*"russia" + 0.003*"wont"')]
 
[(0,
  '0.046*"link" + 0.006*"windows" + 0.005*"state" + 0.005*"electric" + '
  '0.005*"delete" + 0.005*"drive" + 0.005*"teams" + 0.004*"face" + '
  '0.004*"poem" + 0.004*"tiktok"'),
 (1,
  '0.011*"women" + 0.008*"god" + 0.008*"care" + 0.007*"sentient" + 0.007*"men" '
  '+ 0.006*"bullshit" + 0.005*"biological" + 0.005*"planet" + 0.004*"holy" + '
  '0.004*"bag"'),
 (2,
  '0.018*"like" + 0.011*"would" + 0.010*"think" + 0.008*"even" + '
  '0.008*"people" + 0.007*"know" + 0.007*"good" + 0.006*"way" + '
  '0.006*"something" + 0.006*"could"'),
 (3,
  '0.070*"bot" + 0.030*"open" + 0.029*"please" + 0.027*"prompt" + '
  '0.021*"source" + 0.018*"message" + 0.017*"image" + 0.017*"questions" + '
  '0.015*"free" + 0.015*"amp"'),
 (4,
  '0.015*"bing" + 0.015*"thank" + 0.011*"bard" + 0.010*"answer" + '
  '0.009*"youtube" + 0.009*"thanks" + 0.008*"dumb" + 0.008*"question" + '
  '0.007*"turbo" + 0.007*"web"'),
 (5,
  '0.017*"use" + 0.016*"api" + 0.013*"text" + 0.012*"data" + 0.010*"user" + '
  '0.010*"code" + 0.009*"openai" + 0.008*"content" + 0.008*"prompt" + '
  '0.007*"chat"'),
 (6,
  '0.009*"get" + 0.008*"people" + 0.008*"time" + 0.006*"like" + 0.006*"pay" + '
  '0.005*"work" + 0.005*"make" + 0.005*"company" + 0.005*"years" + '
  '0.005*"use"'),
 (7,
  '0.006*"wolfram" + 0.006*"willing" + 0.006*"elon" + 0.005*"cap" + '
  '0.004*"fictional" + 0.004*"percentile" + 0.004*"sample" + 0.004*"dollar" + '
  '0.004*"censored" + 0.004*"repetition"'),
 (8,
  '0.007*"game" + 0.007*"amp" + 0.006*"world" + 0.005*"language" + '
  '0.005*"prompt" + 0.004*"character" + 0.004*"story" + 0.004*"response" + '
  '0.004*"provide" + 0.004*"knowledge"')]

Robustness testing
Using the sampling model set up in Part II, use the model from the original dataset "Processed_GPT_total.json" and set random.seed(61) to take 10,000 samples as a subset and name it " subsets_GPT_total.json"

 

 

 
Topic 0: ['art', 'people', 'life', 'industry', 'market', 'pig', 'sister', 'business', 'technology', 'profit']
Topic 1: ['use', 'api', 'code', 'prompt', 'openai', 'text', 'get', 'chat', 'content', 'version']
Topic 2: ['tom', 'youtube', 'also', 'tone', 'blog', 'words', 'use', 'copyright', 'pay', 'battery']
Topic 3: ['like', 'would', 'know', 'good', 'get', 'people', 'really', 'time', 'even', 'something']
Topic 4: ['bot', 'prompt', 'please', 'open', 'questions', 'discord', 'automatically', 'free', 'subreddit', 'message']
Topic 5: ['houses', 'link', 'district', 'red', 'para', 'winter', 'governed', 'blue', 'sol', 'fewer']
Topic 6: ['think', 'human', 'could', 'would', 'people', 'even', 'time', 'make', 'like', 'way']

 

 

6.