Small changes to people's writing style can reveal which social group they "belong to" at a given moment say psychologists.
Groups are central to human identity, and most people are part of multiple groups based on shared interests or characteristics - ranging from local clubs to national identity.
When one of these group memberships becomes relevant in a particular situation, behaviour tends to follow the norms of this group so that people behave "appropriately".
The new study - by Lancaster University, the University of Exeter, Imperial College London and University College London - demonstrates that group normative behaviour is reflected in a person's writing style.
It also shows that assessing writing style can reveal - with an accuracy of about 70% - which of two groups affected a person while they were writing a particular piece of text.
The paper, published in the journal Behavior Research Methods, is entitled: "ASIA: Automated Social Identity Assessment using linguistic style."
Professor Mark Levine of Lancaster University said: "Our work shows that it is possible to see changes in the way people are thinking about themselves - just from the way they write. These identity traces seem to be present even when we control for the topics that people are writing about - or where they are doing the writing. The ASIA tool kit is an important advance in our ability to study the way psychological identity plays a role in shaping behaviour."
To demonstrate their method, researchers studied how people who are parents and feminists change their writing style when they move from one identity to another on anonymous online forums such as Reddit, Mumsnet and Netmums.
"People are not just one thing - we change who we are, our identity, from situation to situation," said Dr Miriam Koschate-Reis from the University of Exeter.
"In the current situation, many people will need to switch between being a parent and being an employee as they are trying to manage home schooling, childcare and work commitments.
"Switches between identities influence behaviour in multiple ways, and in our study we tracked which identity was active by focussing on language.
"We found that people not only change their writing style to impress their audience - they change it based on the group identity that is influencing them at the time.
"So, when we asked people in an experiment to think about themselves as a parent, their language patterns reflected this."
The study avoided "content" words (a parent might mention "childcare" for example) and focussed on stylistic patterns including use of pronouns, "intellectual" words and words expressing emotions.
Commenting on the possible uses of the new method, Dr Koschate-Reis said: "We are currently focussing on mental health.
"It is the first method that lets us study how people access different group identities outside the laboratory on a large scale, in a quantified way.
"For example, it gives us the opportunity to understand how people acquire new identities, such as becoming a first-time parent, and whether difficulties 'getting into' this identity may be linked to postnatal depression and anxiety.
"Our method could help to inform policies and interventions in this area, and in many others."
Group identities have been found to affect thoughts, emotions and behaviour in many settings - from work contexts to education to political activism.
Research is ongoing to understand how much control we have over switches between different identities - most of which are thought to be triggered by the social context.
Dr Koschate-Reis said it might be possible to manipulate the cues that trigger an identity switch by going to a location associated with the identity.
For example, students might find it easier to write in an "academic style" when they are in the library rather than the local coffee shop.
The study was funded by the Engineering and Physical Sciences Research Council (EPSRC).
Behavior Research Methods