- Regular article
- Open Access
Word usage mirrors community structure in the online social network Twitter
© Bryden et al.; licensee Springer. 2013
Received: 4 October 2012
Accepted: 13 February 2013
Published: 25 February 2013
Language has functions that transcend the transmission of information and varies with social context. To find out how language and social network structure interlink, we studied communication on Twitter, a broadly-used online messaging service.
We show that the network emerging from user communication can be structured into a hierarchy of communities, and that the frequencies of words used within those communities closely replicate this pattern. Consequently, communities can be characterised by their most significantly used words. The words used by an individual user, in turn, can be used to predict the community of which that user is a member.
This indicates a relationship between human language and social networks, and suggests that the study of online communication offers vast potential for understanding the fabric of human society. Our approach can be used for enriching community detection with word analysis, which provides the ability to automate the classification of communities in social networks and identify emerging social groups.
The complexity and depth of our language is a unique and defining feature of humans. Language permeates our daily lives as we use it to convey information from simple messages to opinions and complex arguments. In addition, it has a number of functions that transcend the transmission of information, with a range of social implications. Sociolinguistic studies have shown how varieties of a language can be strongly associated with established social or cultural groups [1–5]. In general, these studies have tended to concentrate on small, distinct and relatively stable communities such as gangs [6, 7] or inner-city working communities .
In the study of complex networks, the term communities is used to denote parts of the network that are more strongly linked within themselves than to the rest of the network, a phenomenon that has been observed in many human social networks . In this sense, communities are an emergent property of network structure. Much work has gone into developing methods to detect such groups from topological analysis , and the extent to which this is possible has been termed modularity . The communities found in this way are usually associated with groups of friends or acquaintances, or similarity in traits [9, 12, 13]. If these communities overlap with social or cultural groups, the use of language should vary between different communities in a social network . Taking word usage as a proxy for variation in language [14, 15], we hypothesise that this variation should closely match the community structure of the network.
To test this hypothesis, we studied word usage in a weighted network created from communication between about 250,000 users of the social networking and microblogging site Twitter, and analysed if groups identified within the interaction network indeed had unique language features. Twitter communication is unstructured in the sense that every user can send a message to any other user. In constructing our network, we formed a link only when users had mutually directed messages at each other, analogously to what has been done in the study of mobile phone networks . We used methods from statistical physics and network theory to identify groups in the network structure that emerge from user interaction, and linked this to word frequencies in the messages generated by each user.
Results and discussion
The network analysed had 189,000 nodes (each corresponding to a single user) with 75 million mutual tweets between them (mean degree of 28) and a global clustering coefficient of 0.084.
Characterising communities through word usage
We characterised each of the communities according to the words used in messages sent by the users of the community. To do this, we ranked words in each community by the Z-score of their usage to identify the words most representative of that community. Figure 1 gives illustrative examples of words that characterise each English-speaking community of more than 250 users (see Additional file 1 for the lists of top-ranked words). We surveyed the mean global frequencies for the 100 top-ranked words of each community, finding a broad range. Some communities used relatively common words (at 13% of global usage), while others used much rarer words (at 0.04% of global usage).
To determine the significance of word usage differences, we calculated the Euclidean distance of relative word usage frequencies for each pair of English-language communities using a bootstrap. For each such pair of communities, we sampled two new groups (with replacement) from their union until they had the same sizes as the communities being compared. Repeating this procedure 1,000 times for each pair of communities, we found that for 248 of the 253 pairs of communities the distance between the original pair was greater than all of the 1,000 resampled pairs. For the other five pairs of communities, the distance between them was greater than most () of the resamples. Comparable results were found for the communities generated with the hierarchical map equation algorithm. In other words, the community membership can explain part of the variance of word usage.
Language patterns of communities
Number of occurrences
n**ga, poppin, chillin
shortened endings (‘er’ → ‘a’ or ‘ing’ → ‘in’)
pln, edtech, edublogs
anipals, pawsome, furever
animal based puns
bieber, pleasee, <33
lengthened endings (repeated last letter)
kstew, robsessed, twilighters
amalgamations/puns around Twilight movie genre
tdd, mvc, linq
kradam, glambert, glamily
puns around pop star Adam Lambert
Predicting community membership from word usage
Comparing different partitions, the hierarchical map equation predicted the community of more users correctly than the high-level modularity maximisation partition. Analysing a random sample of 1,000 words of each user, we were able to predict the correct map equation community for approximately 72% of English-speaking users, compared to 48% with the modularity maximisation partition. Using the numbers of communities generated by each algorithm ( for the map equation versus for modularity maximisation), we calculated the Z-score for these prediction scores. The Z-score for the map equation () was greater than that for the modularity maximisation (). When, on the other hand, considering the lowest-level partition produced by the modularity maximisation algorithm, the fraction of users predicted correctly drops to 38%. When taking into account the number of communities (), though, the Z-score is greater than for both of the other partitions ().
Given the community structure of the network, around half of messages will be directed to users in the high-level communities we predict. This means that, once a network is analysed, it is possible to assign the most likely community or communities for any user that was not part of the community detection. This can be done solely on the basis of the word frequencies in a relatively small sample of text written by that user. The proportion of topological groups predicted correctly from analysis of word usage increases roughly exponentially with the number of words sampled from each user (Figure 2).
We studied the relation between community structure in an online social network and language use in messages within that network, and found a striking overlap, whether we considered words, word fragments or word lengths. Moreover, we were able to predict the network community of a user, a purely structural feature, by studying his or her word usage, and we found that this was possible with rapidly growing accuracy for relatively few words sampled. This indicates how the language we use bears the signature of societal structure, and is suggestive of the enormous potential in using topological analysis to identify cultural groups.
A pair of users that engage in a online conversation would be expected to have some language in common. When groups of individuals share language, and also converse with each other, then it is possible to use our method to identify these groups and enrich them with the language they are using. A wide range of alternative algorithms may also be used . A full exploration of these is beyond the scope of this paper, but may show improvements in identifying communities with more unique language patterns. Further improvements might be made by replacing Z-score metric we have used to identify words that stand out with a term frequency-inverse document frequency metric .
Our sample is only a small proportion of the much larger twitter network and one could ask whether the sampling process introduces a bias in the community structure we detect. Our sample network has small-world properties (average shortest path length ), indicating that the sampling process should very quickly reach every community in the network. Resampling the network confirms this intuition. For very small resamples (), the shortest path length is greater than L, but on further sampling it converges towards L. Similarly, modularity decreases initially with the size of the resample before it converges, indicating that after enough sampling the process is no longer biased toward any particular community. This is consistent with previous analysis of this type of sampling process which showed that (given certain assumptions) it is a regular Markov process , and thus that the community being sampled is independent of the community at the origin of the sample . Overall, this resampling analysis demonstrates that our sampling procedure quickly discovers the larger communities in the network if they are not completely isolated. With more sampling, smaller communities and sub-communities can also be discovered.
The finding that people can be placed in a community by analysing their language usage is consistent with evidence that humans make long-term decisions about relationships very quickly . Our results give an indication that words could be markers of desirable underlying traits or social norms , allowing people to make quick decisions about the type of relationship they want from a new acquaintance. The community structure we observe in the network could be explained through homophily [13, 28], that is, through people biasing their interactions to others that are similar in some way, or through dyadic interactions . More generally, any process that structures people into groups could play a strong role in cultural evolution [29–32], as well as in the spread of information or pathogens [33, 34]. If people with a negative attitude towards vaccination are preferentially in contact with those of the same opinion, this could lead to clusters of susceptibles and increased risk of outbreaks . There is clearly scope for further study of the role such structuring plays in the evolution of cooperation in humans .
Online social networks offer us an unprecedented opportunity to systematically study the large-scale structure of human interactions . Our approach suggests that groups with distinctive cultural characteristics or common interests can be discovered by identifying communities in interaction networks purely on the basis of topological structure. This approach has several benefits when compared to surveying groups identified on a smaller scale: it is systematic, and groups are identified and classified in an unbiased way; when applied to online social networks it is non-intrusive; and it easily makes use a large volume of rich data. In this study we characterise groups by their word frequencies, but this could be extended to quantify other cultural characteristics. Moreover, methods to detect overlapping communities could be used to test in how much these overlap , and whether individuals belong to multiple communities and use different word sets in each of them . There are numerous applications of our method, including social group identification, customising online experience, targeted marketing, and crowd-sourced characterisation.
Our sample network was formed using a process called snowball-sampling : For each user sampled, all their conversational tweets (i.e., tweets that are directed at another user) were recorded and any new users referenced added to a list of users from which the next user to be sampled is picked. Starting from a random user, conversational tweets, time-stamped between January 2007 to November 2009 were sampled from the Twitter web site during December 2009, yielding over 200 million messages. We ignored messages that were copies of other messages (so called retweets, which are identified by the text ‘RT’). The links in the network were bidirectional and weighted by the number of tweets sent between the two users linked.
Ranking words within a community
where N is the global number of users.
Comparing communities using a bootstrap
We confirmed that the distribution of resampled distances was close to a normal distribution. Over many resampled pairs, the frequency of instances when this inequality was true gave us the probability that the difference in word usage between the two communities could have happened by chance if words were randomly distributed amongst communities.
Predicting communities of individual users
The authors would like to express their gratitude to Edwin van Leeuwen for helpful discussions. This work was supported by the Engineering and Physical Sciences Research Council through standard research grant number EP/D002249/1, by the Biotechnology and Biological Sciences Research Council grant BB/I000151/1 (to V.A.A.J.), by the Economic and Social Research Council grant (ES/L000113/1), by the EU FP7 funded integrated project EPIWORK (grant agreement number 231807), by the US Department of Homeland Security and by the Bill and Melinda Gates Foundation.
- Gumperz J: Dialect differences and social stratification in a North Indian village. Am Anthropol 1958,60(4):148–170.View ArticleGoogle Scholar
- Labov W: The linguistic variable as structural unit. Wash Linguist Rev 1966, 3: 4–22.Google Scholar
- Chambers JK: Sociolinguistic theory. Blackwell, Oxford; 1997.Google Scholar
- Carroll KS: Puerto Rican language use on myspace.com. Cent J 2008, 20: 96–111.Google Scholar
- Mæhlum B: Language and social spaces.1. In Language and space: theories and methods. Edited by: Auer P, Schmidt JE. de Gruyter, Berlin; 2010.Google Scholar
- Labov T: Social structure and peer terminology in a black adolescent gang. Lang Soc 1982, 11: 391–411. 10.1017/S0047404500009374View ArticleGoogle Scholar
- Mendoza-Denton N: Homegirls: language and cultural practices among Latina youth gangs. Blackwell, Oxford; 2007.Google Scholar
- Milroy L: Language and social networks. Blackwell, Oxford; 1980.Google Scholar
- Porter MA: Communities in networks. Not Am Math Soc 2009,56(9):1164–1166.Google Scholar
- Fortunato S: Community detection in graphs. Phys Rep 2010, 486: 75–174. 10.1016/j.physrep.2009.11.002MathSciNetView ArticleGoogle Scholar
- Newman MEJ: Modularity and community structure in networks. Proc Natl Acad Sci USA 2006,103(23):8577–8582. 10.1073/pnas.0601602103View ArticleGoogle Scholar
- Traud AL, Kelsic ED, Mucha PJ, Porter MA: Comparing community structure to characteristics in online collegiate social networks. SIAM Rev 2011,53(3):526–543. 10.1137/080734315MathSciNetView ArticleGoogle Scholar
- Bryden J, Funk S, Geard N, Bullock S, Jansen VAA: Stability in flux: community structure in dynamic networks. J R Soc Interface 2011,8(60):1031–1040. 10.1098/rsif.2010.0524View ArticleGoogle Scholar
- Kucera H, Francis WN: Frequency analysis of English usage: lexicon and grammar. Houghton Mifflin, Boston; 1982.Google Scholar
- Michel J, Shen YK, Aiden AP, Veres A, Gray MK, Pickett JP, Hoiberg D, Clancy D, Norvig P, Orwant J, Pinker S, Nowak MA, Aiden AL, The Google Books Team: Quantitative analysis of culture using millions of digitized books. Science 2010, 331: 176–182.View ArticleGoogle Scholar
- Kumpula JM, Onnela JP, Saramaki J, Kaski K, Kertesz J: Emergence of communities in weighted networks. Phys Rev Lett 2007., 99: Article ID 228701 Article ID 228701Google Scholar
- Blondel VD, Guillaume J, Lambiotte R, Lefebvre E: Fast unfolding of communities in large networks. J Stat Mech Theory Exp 2008.,2008(10): Article ID P10008 Article ID P10008Google Scholar
- Reichardt J, Bornholdt S: Partitioning and modularity of graphs with arbitrary degree distribution. Phys Rev E 2007., 76: Article ID 015102 Article ID 015102Google Scholar
- Rosvall M, Bergstrom CT: Maps of random walks on complex networks reveal community structure. Proc Natl Acad Sci USA 2008,105(4):1118–1123. 10.1073/pnas.0706851105View ArticleGoogle Scholar
- Rosvall M, Axelsson D, Bergstrom CT: The map equation. Eur Phys J Spec Top 2009, 178: 13–23. 10.1140/epjst/e2010-01179-1View ArticleGoogle Scholar
- Rosvall M, Bergstrom CT: Multilevel compression of random walks on networks reveals hierarchical organization in large integrated systems. PLoS ONE 2011.,6(4): Article ID e18209. http://dx.doi.org/10.1371%2Fjournal.pone.0018209 Article ID e18209. http://dx.doi.org/10.1371%2Fjournal.pone.0018209Google Scholar
- Lancichinetti A, Fortunato S: Community detection algorithms: a comparative analysis. Phys Rev E 2009., 80: Article ID 056117 Article ID 056117Google Scholar
- Salton G, Buckley C: Term-weighting approaches in automatic text retrieval. Inf Process Manag 1988,24(5):513–523. http://www.sciencedirect.com/science/article/pii/0306457388900210 http://www.sciencedirect.com/science/article/pii/0306457388900210 10.1016/0306-4573(88)90021-0View ArticleGoogle Scholar
- Heckathorn DD: Respondent-driven sampling: a new approach to the study of hidden populations. Soc Probl 1997, 44: 174–199. 10.2307/3096941View ArticleGoogle Scholar
- Kemeny JG, Snell JL: Finite Markov chains. Van Nostrand, Princeton; 1960.Google Scholar
- Sunnafrank M, Ramirez A Jr: At first sight: persistent relational effects of get-acquainted conversations. J Soc Pers Relatsh 2004,21(3):361–379. 10.1177/0265407504042837View ArticleGoogle Scholar
- McElreath R, Boyd R, Richerson PJ: Shared norms and the evolution of ethnic markers. Curr Anthropol 2003, 44: 122–129. 10.1086/345689View ArticleGoogle Scholar
- McPherson JM, Smith-Lovin L, Cook J: Birds of a feather: homophily in social networks. Annu Rev Sociol 2001, 27: 415–444. 10.1146/annurev.soc.27.1.415View ArticleGoogle Scholar
- Fehr E, Fischbacher U: Social norms and human cooperation. Trends Cogn Sci 2004,8(4):185–190. 10.1016/j.tics.2004.02.007View ArticleGoogle Scholar
- Centola D, Gonzalez-Avella JC, Eguiluz VM, Miguel MS: Homophily, cultural drift, and the co-evolution of cultural groups. J Confl Resolut 2007,51(6):905–929. 10.1177/0022002707307632View ArticleGoogle Scholar
- Boyd R, Richerson PJ: Culture and the evolution of human cooperation. Philos Trans R Soc Lond B 2009,364(1533):3281–3288. 10.1098/rstb.2009.0134View ArticleGoogle Scholar
- Hill KR, Walker RS, Boz̆ic̆ević M, Eder J, Headland T, Hewlett B, Hurtado AM, Marlowe F, Wiessner P, Wood B: Co-residence patterns in hunter-gatherer societies show unique human social structure. Science 2011,331(6022):1286–1289. 10.1126/science.1199071View ArticleGoogle Scholar
- Funk S, Gilad E, Watkins C, Jansen VAA: The spread of awareness and its impact on epidemic outbreaks. Proc Natl Acad Sci USA 2009,106(16):6872–6877. 10.1073/pnas.0810762106View ArticleGoogle Scholar
- Salathé M, Jones JH: Dynamics and control of diseases in networks with community structure. PLoS Comput Biol 2010.,6(4): Article ID e1000736Google Scholar
- Salathé M, Bonhoeffer S: The effect of opinion clustering on disease outbreaks. J R Soc Interface 2008,5(29):1505–1508. 10.1098/rsif.2008.0271View ArticleGoogle Scholar
- Efferson C, Lalive R, Fehr E: The coevolution of cultural groups and ingroup favoritism. Science 2008,321(5897):1844–1849. 10.1126/science.1155805View ArticleGoogle Scholar
- Lazer D, Pentland A, Adamic L, Aral S, Barabasi A, Brewer D, Christakis N, Contractor N, Fowler J, Gutmann M, Jebara T, King G, Macy M, Roy D, Alstyne MV: Computational social science. Science 2009,323(5915):721–723. 10.1126/science.1167742View ArticleGoogle Scholar
- Ahn YY, Bagrow JP, Lehmann S: Link communities reveal multiscale complexity in networks. Nature 2010, 466: 761–764. 10.1038/nature09182View ArticleGoogle Scholar
- Clark HH, Brennan SE: Grounding in communication. In Perspectives on socially shared cognition. Edited by: Resnick LB, Levine JM, Teasley SD. Am Psychol Assoc, Washington; 1991.Google Scholar
- Goodman LA: Snowball sampling. Ann Math Stat 1961, 32: 148–170. 10.1214/aoms/1177705148View ArticleGoogle Scholar
This article is published under license to BioMed Central Ltd. This is an Open Access article distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/2.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.