Density-Based Clustering for Twitter Sentiment Analysis Using Artificial Intelligence | Research Square window.SnipcartSettings = { analytics: { enabled: false } }; (function() { var accessVector = localStorage.getItem('access_vector') || ''; window.dataLayer = window.dataLayer || []; if (accessVector) { window.dataLayer.push({ user: { profile: { profileInfo: { snid: accessVector } } } }); } })(); (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-K279D39R'); Browse Preprints In Review Journals COVID-19 Preprints AJE Video Bytes Research Tools Research Promotion AJE Professional Editing AJE Rubriq About Preprint Platform In Review Editorial Policies Our Team Advisory Board Help Center Sign In Submit a Preprint Cite Share Download PDF Research Article Density-Based Clustering for Twitter Sentiment Analysis Using Artificial Intelligence Maya ALGhafri, Imran Khan, Abdelhamid Abdessalem This is a preprint; it has not been peer reviewed by a journal. https://doi.org/ 10.21203/rs.3.rs-6443242/v1 This work is licensed under a CC BY 4.0 License Status: Posted Version 1 posted You are reading this latest preprint version Abstract In this paper, we tackle the challenge of analyzing Twitter data, which is rich in opinions but lacks labels, making it difficult for computers to organize. We propose a solution that consists of grouping similar tweets together, improving the accuracy of sentiment analysis and helping us better understand people’s opinions and emotions expressed on Twitter. We introduce a new density-based clustering algorithm that identifies dense areas in the dataset by determining the density of each feature in the Term Frequency-Inverse Document Frequency (TF-IDF) data matrix. Next, we use an extended version of the k-means clustering algorithm to generate clustering results based on the identified dense areas. These clustering results categorize tweets into positive, negative, and neutral sentiment within each cluster. We then apply a topic modeling technique, specifically Latent Dirichlet Allocation, for sentiment analysis within each category. Experimental results on synthetic data show that our proposed algorithm outperforms current state-of-the-art approaches. Finally, we present results related to public sentiment regarding the use of ChatGPT, a generative AI model, in education, utilizing Twitter data. Sentiment Analysis Clustering Machine Learning Latent Dirichlet Allocation Natural Language Processing Artificial Intelligence Full Text Additional Declarations No competing interests reported. Cite Share Download PDF Status: Posted Version 1 posted You are reading this latest preprint version Research Square lets you share your work early, gain feedback from the community, and start making changes to your manuscript prior to peer review in a journal. As a division of Research Square Company, we’re committed to making research communication faster, fairer, and more useful. We do this by developing innovative software and high quality services for the global research community. Our growing team is made up of researchers and industry professionals working together to solve the most critical problems facing scientific publishing. Also discoverable on Platform About Our Team In Review Editorial Policies Advisory Board Help Center Resources Author Services Accessibility API Access RSS feed Manage Cookie Preferences © Research Square 2026 | ISSN 2693-5015 (online) Privacy Policy Terms of Service Do Not Sell My Personal Information {"props":{"pageProps":{"initialData":{"identity":"rs-6443242","acceptedTermsAndConditions":true,"allowDirectSubmit":true,"archivedVersions":[],"articleType":"Research Article","associatedPublications":[],"authors":[{"id":456445882,"identity":"77b9ece1-4f7b-49ad-9ede-30812317d8e9","order_by":0,"name":"Maya ALGhafri","email":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAAyAQMAAABI0h/eAAAABlBMVEX///8AAABVwtN+AAAACXBIWXMAAA7EAAAOxAGVKw4bAAABF0lEQVRIiWNgGAWjYLCCDxUMMgwSQJrBwAbIZWw8QEgH44wzDDxALYwzGAzSQPwGglqYedtgWhgOg0XwatFtP2P4mYfNjkc+uvlhc0XBebu17YeBttTYROPSYnYmx1hyDk8yj+GdY4aNZwxuJ287kwjUciwttwGXlgM5BhJvJJh5DGckmD9sAGoxOwDUwthwGLeW82+Mf/AY1AO1pH9sbDA4l2x2/iEBLTdyzCR5Eg7zyEvkGAK1HLAzu0HIlhvPyixnHDjOYyCRUwjUkpxgdgNoSwI+v5xP3nzj479qOfkZ6RsbG/7Y2ZudT3/44EONDU4tDAwcBmDK4ACEmwhWmYBTOQiwPwBT8lBD7fEqHgWjYBSMghEJAJ9PaREGSy+TAAAAAElFTkSuQmCC","orcid":"","institution":"","correspondingAuthor":true,"prefix":"","firstName":"Maya","middleName":"","lastName":"ALGhafri","suffix":""},{"id":456445883,"identity":"65b533cf-f87c-4ce8-946a-2a99876ce876","order_by":1,"name":"Imran Khan","email":"","orcid":"","institution":"","correspondingAuthor":false,"prefix":"","firstName":"Imran","middleName":"","lastName":"Khan","suffix":""},{"id":456445884,"identity":"63a92556-aca4-44ed-90b9-0eb3d16f64df","order_by":2,"name":"Abdelhamid Abdessalem","email":"","orcid":"","institution":"","correspondingAuthor":false,"prefix":"","firstName":"Abdelhamid","middleName":"","lastName":"Abdessalem","suffix":""}],"badges":[],"createdAt":"2025-04-14 07:08:20","currentVersionCode":1,"declarations":"","doi":"10.21203/rs.3.rs-6443242/v1","doiUrl":"https://doi.org/10.21203/rs.3.rs-6443242/v1","draftVersion":[],"editorialEvents":[],"editorialNote":"","failedWorkflow":false,"files":[{"id":96692129,"identity":"7e1e81b9-618e-463a-a90f-ba6bf57fbb56","added_by":"auto","created_at":"2025-11-25 06:54:09","extension":"pdf","order_by":1,"title":"","display":"","copyAsset":false,"role":"manuscript-pdf","size":1227624,"visible":true,"origin":"","legend":"","description":"","filename":"DensityBasedClusteringforTwitterSentimentAnalysisUsingAI.pdf","url":"https://assets-eu.researchsquare.com/files/rs-6443242/v1_covered_0b152ad8-dc96-42e5-85c2-0a77befd4ff9.pdf"}],"financialInterests":"No competing interests reported.","formattedTitle":"Density-Based Clustering for Twitter Sentiment Analysis Using Artificial Intelligence","fulltext":[],"fulltextSource":"","fullText":"","funders":[],"hasAdminPriorityOnWorkflow":false,"hasManuscriptDocX":false,"hasOptedInToPreprint":true,"hasPassedJournalQc":"","hasAnyPriority":false,"hideJournal":true,"highlight":"","institution":"","isAcceptedByJournal":false,"isAuthorSuppliedPdf":true,"isDeskRejected":"","isHiddenFromSearch":false,"isInQc":false,"isInWorkflow":false,"isPdf":true,"isPdfUpToDate":true,"isWithdrawnOrRetracted":false,"journal":{"display":true,"email":"
[email protected]","identity":"researchsquare","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":true,"externalIdentity":"","sideBox":"","snPcode":"","submissionUrl":"/submission","title":"Research Square","twitterHandle":"researchsquare","acdcEnabled":true,"dfaEnabled":false,"editorialSystem":"","reportingPortfolio":"","inReviewEnabled":false,"inReviewRevisionsEnabled":true},"keywords":"Sentiment Analysis, Clustering, Machine Learning, Latent Dirichlet Allocation, Natural Language Processing, Artificial Intelligence","lastPublishedDoi":"10.21203/rs.3.rs-6443242/v1","lastPublishedDoiUrl":"https://doi.org/10.21203/rs.3.rs-6443242/v1","license":{"name":"CC BY 4.0","url":"https://creativecommons.org/licenses/by/4.0/"},"manuscriptAbstract":"In this paper, we tackle the challenge of analyzing Twitter data, which is rich in opinions but lacks labels, making it difficult for computers to organize. We propose a solution that consists of grouping similar tweets together, improving the accuracy of sentiment analysis and helping us better understand people’s opinions and emotions expressed on Twitter. We introduce a new density-based clustering algorithm that identifies dense areas in the dataset by determining the density of each feature in the Term Frequency-Inverse Document Frequency (TF-IDF) data matrix. Next, we use an extended version of the k-means clustering algorithm to generate clustering results based on the identified dense areas. These clustering results categorize tweets into positive, negative, and neutral sentiment within each cluster. We then apply a topic modeling technique, specifically Latent Dirichlet Allocation, for sentiment analysis within each category. Experimental results on synthetic data show that our proposed algorithm outperforms current state-of-the-art approaches. Finally, we present results related to public sentiment regarding the use of ChatGPT, a generative AI model, in education, utilizing Twitter data.","manuscriptTitle":"Density-Based Clustering for Twitter Sentiment Analysis Using Artificial Intelligence","msid":"","msnumber":"","nonDraftVersions":[{"code":1,"date":"2025-05-15 04:34:16","doi":"10.21203/rs.3.rs-6443242/v1","editorialEvents":[{"type":"communityComments","content":0}],"status":"published","journal":{"display":true,"email":"
[email protected]","identity":"researchsquare","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":true,"externalIdentity":"","sideBox":"","snPcode":"","submissionUrl":"/submission","title":"Research Square","twitterHandle":"researchsquare","acdcEnabled":true,"dfaEnabled":false,"editorialSystem":"","reportingPortfolio":"","inReviewEnabled":false,"inReviewRevisionsEnabled":true}}],"origin":"","ownerIdentity":"471e698b-aee4-4781-ad02-a8c5e10003cb","owner":[],"postedDate":"May 15th, 2025","published":true,"recentEditorialEvents":[],"rejectedJournal":[],"revision":"","amendment":"","status":"posted","subjectAreas":[],"tags":[],"updatedAt":"2025-11-25T06:53:50+00:00","versionOfRecord":[],"versionCreatedAt":"2025-05-15 04:34:16","video":"","vorDoi":"","vorDoiUrl":"","workflowStages":[]},"version":"v1","identity":"rs-6443242","journalConfig":"researchsquare"},"__N_SSP":true},"page":"/article/[identity]/[[...version]]","query":{"redirect":"/article/rs-6443242","identity":"rs-6443242","version":["v1"]},"buildId":"8U1c8b4HqxoKbykW_rLl7","isFallback":false,"isExperimentalCompile":false,"dynamicIds":[84888],"gssp":true,"scriptLoader":[]}
Text is read by the "Ask this paper" AI Q&A widget below.
Extraction quality varies by source — PMC NXML preserves structure
cleanly, OA-HTML may include some navigation residue, and OA-PDF can
have broken hyphenation. The publisher copy
(via DOI)
is the canonical version.