Loneliness is a growing public health concern in the United States, with about 17% of adults between the ages of 18 and 70 reporting feeling lonely.

Now, a team of researchers at the University of Pennsylvania has turned to Twitter to see if they can identify linguistic markers of loneliness based on user’s posts. They are part of a growing group of scientists studying social media to identify early signs of mental health issues, such as depression and anxiety.

For the study, published in BMJ Open, researchers collected about 400 million tweets from users in Pennsylvania between 2012 and 2016.

They then identified users whose posts contained the words “lonely” or “alone” at least five times, and used artificial intelligence to study the topics and daily patterns of users’ posts. The researchers also looked at language patterns in the posts, comparing them with posts from a control group that did not use the two words.

“We chose the words ‘lonely’ and ‘alone’ after we did an extensive literature review on what words individuals use when they experience loneliness,” said Rachelle Schneider, a research coordinator at the Penn Medicine Center for Digital Health and lead author of the study.

“If we’re able to passively identify loneliness, we can intervene sooner,” Schneider said.

Researchers found that people who mentioned loneliness on Twitter also posted about substance use and relationship troubles. Those users also reported higher levels of anxiety, anger, and other negative moods, and researchers found that what time they posted (more often in the middle of the night) reflected that sleep deprivation can contribute to social withdrawal and loneliness as well.

Even though loneliness is not included in the Diagnostic and Statistical Manual of Mental Disorders (DSM), it can affect cognitive function, sleep patterns, and blood pressure. Young people who have higher levels of social media use may be more likely to experience social isolation, a 2017 study published by the American Journal of Preventive Medicine suggested. Yet even though it’s a public health concern, health care providers haven’t had a way to measure loneliness beyond surveys, which rely on the respondents’ self-awareness.

“What we’ve been thinking about a lot is, ‘Does social media create more loneliness? Or is social media this vehicle that can prevent loneliness?’” Raina Merchant, the head of the Center for Digital Health and the senior author of the study, said. “The challenge is that we know loneliness is a subjective feeling.”

Merchant said that health care providers could do a better job of screening for loneliness if there were more approaches available. She said that she hopes to offer people support by connecting them to others who feel similarly after showing them what their posts reflect.

The researchers also plan to examine other social media platforms, like Facebook, Instagram and Reddit, to see if people express loneliness differently on those. In time, they want to develop an intervention approach that blends social media and in-person interactions.

“From our studies, people experiencing loneliness seem to be using social media as a venue to express themselves, but they’re not having a lot of interpersonal actions,” said Sharath Guntuku, a research scientist at the Center for Digital Health and the other lead author of the paper. “But it’s promising because they’re open to sharing things from their electronics, and we can target some of these interventions to them.”

“What’s been really compelling for us is that loneliness is pretty prevalent,” Merchant said. “It doesn’t discriminate. Everybody feels lonely at some point in time, and some people have skills or opportunities to address it, while others don’t. Hopefully this makes people look more closely at these posts about being alone or feeling lonely, and think about ways to support them.”