{"doi":"10.2196/41517","title":"Sentiment Analysis of Insomnia-Related Tweets via a Combination of Transformers Using Dempster-Shafer Theory: Pre– and Peri–COVID-19 Pandemic Retrospective Study","abstract":"BACKGROUND: The COVID-19 pandemic has imposed additional stress on population health that may result in a change of sleeping behavior. OBJECTIVE: In this study, we hypothesized that using natural language processing to explore social media would help with assessing the mental health conditions of people experiencing insomnia after the outbreak of COVID-19. METHODS: We designed a retrospective study that used public social media content from Twitter. We categorized insomnia-related tweets based on time, using the following two intervals: the prepandemic (January 1, 2019, to January 1, 2020) and peripandemic (January 1, 2020, to January 1, 2021) intervals. We performed a sentiment analysis by using pretrained transformers in conjunction with Dempster-Shafer theory (DST) to classify the polarity of emotions as positive, negative, and neutral. We validated the proposed pipeline on 300 annotated tweets. Additionally, we performed a temporal analysis to examine the effect of time on Twitter users' insomnia experiences, using logistic regression. RESULTS: We extracted 305,321 tweets containing the word insomnia (prepandemic tweets: n=139,561; peripandemic tweets: n=165,760). The best combination of pretrained transformers (combined via DST) yielded 84% accuracy. By using this pipeline, we found that the odds of posting negative tweets (odds ratio [OR] 1.39, 95% CI 1.37-1.41; P<.001) were higher in the peripandemic interval compared to those in the prepandemic interval. The likelihood of posting negative tweets after midnight was 21% higher than that before midnight (OR 1.21, 95% CI 1.19-1.23; P<.001). In the prepandemic interval, while the odds of posting negative tweets were 2% higher after midnight compared to those before midnight (OR 1.02, 95% CI 1.00-1.07; P=.008), they were 43% higher (OR 1.43, 95% CI 1.40-1.46; P<.001) in the peripandemic interval. CONCLUSIONS: The proposed novel sentiment analysis pipeline, which combines pretrained transformers via DST, is capable of classifying the emotions and sentiments of insomnia-related tweets. Twitter users shared more negative tweets about insomnia in the peripandemic interval than in the prepandemic interval. Future studies using a natural language processing framework could assess tweets about other types of psychological distress, habit changes, weight gain resulting from inactivity, and the effect of viral infection on sleep.","journal":"Journal of Medical Internet Research","year":2022,"id":274714,"datarank":0.0,"base_score":0.0,"endowment":0.0,"self_citation_contribution":0.0,"citation_network_contribution":0.0,"self_endowment_contribution":0.0,"citer_contribution":0.0,"corpus_percentile":null,"corpus_rank":null,"citation_count":10,"citer_count":0,"citers_with_citation_signal":0,"citers_with_endowment":0,"datacite_reuse_total":0,"is_dataset":false,"is_dataset_confidence":0.9546,"is_data_producer":false,"deposit_databanks":null,"is_oa":true,"file_count":0,"downloads":0,"has_version_chain":false,"published_date":"2022-01-01","fair_score":null,"fair_percentile":null,"algorithm_id":"datarank_citation_only_1hop_v6","ranking_scope":"data_only","authors":[{"id":763008,"name":"Sara Nowakowski","orcid":"0000-0003-2337-6337","position":1,"is_corresponding":false},{"id":884645,"name":"Ritwick Agrawal","orcid":"0000-0002-7001-581X","position":2,"is_corresponding":false},{"id":744730,"name":"Amir Sharafkhaneh","orcid":"0000-0002-7893-2946","position":3,"is_corresponding":false},{"id":674986,"name":"Mark E. Kunik","orcid":"0000-0002-7349-5521","position":4,"is_corresponding":false},{"id":632276,"name":"Aanand D. Naik","orcid":"0000-0001-6936-7984","position":5,"is_corresponding":false},{"id":12534,"name":"Hua Xu","orcid":"0000-0002-5274-4672","position":6,"is_corresponding":false},{"id":687725,"name":"Javad Razjouyan","orcid":"0000-0003-1157-159X","position":7,"is_corresponding":false},{"id":943262,"name":"Arash Maghsoudi","orcid":"0000-0002-1883-0753","position":0,"is_corresponding":true}],"reference_count":41,"raw_metadata":null,"created_at":"2026-07-19T00:28:12.324621Z","pmid":"36417585","pmcid":null,"fwci":null,"citation_percentile":null,"influential_citations":0,"oa_status":null,"license":null,"views":0,"total_file_size_bytes":0,"version_count":0,"fair_f":null,"fair_a":null,"fair_i":null,"fair_r":null,"fair_zscore":null,"fair_rationale":null,"fair_model":null,"fair_agent_version":null,"fair_fulltext_source":null,"fair_has_llm":null,"fair_computed_at":null,"clinical_trials":[],"software_tools":[],"db_accessions":[],"linked_datasets":[],"topics":[]}