Thursday, May 21, 2015

Osama bin Laden's infodump is as long as the first Harry Potter book, and other revelations of a preliminary text analysis

Yesterday as of this writing (late May 2015), the U.S. Office of the Director of National Intelligence released 103 documents written by Osama bin Laden, captured during the raid on Abbotabad. Of course, my first thought was, "Great, a corpus!".

Bearing in mind that these are translations, here's my preliminary text analysis of the infodump. If you want to see how I did the analysis, check out this IPython notebook.

First of all, to get a taste of the flavor of the whole collection, here's some randomly generated text based on it using a Markov chain:

The secretary of Muslims, but it the new environments at your news, always to take statements from our command of the issue is no harm, or is preferable to convince any operation must take Hamzah arrives here, such expression without an exhortation and all the world. This should be using such as a documentary about Ibn ‘Abbas… In the list you and so that viewed it comes from God. We, thank you and those companions and reads and ready to live in Gaza? Connect them all that he returned to spread the hearts [of the women who may respond to hearing them. He is what it is established system. Usually, these conditions, even with it. He might take me to give support such that it in the path for an end is a dangerous and they are you wish I am just a brother to be upon him very important of the family and that rose up the frontiers area (Islamic Maghreb); so were the reality of those who follows this great hypocrite. I am blessed with his companions… Furthermore, To the world as in missing the tenth anniversary in Algeria more religious issues.

Now the word clouds. Everybody loves word clouds. Except for the people who hate word clouds because they're semi-quantitative at best. Well, you can't have everything.

Here's the word cloud of the vocabulary in all of the documents:

Unsurprisingly, OBL uses a lot of religious terms; 'god' is used so frequently it's in most of the top results when we look at bigrams (two-word phrases):

For the purists, there are bar graphs at the end of the post.

Here's the distribution of document length among the 103 letters/documents:

Most of the documents are short letters, but a couple of them are really long (about 20 pages, double spaced). The two long ones are A Letter to the Sunnah People in Syria and Letter to Shaykh Abu Abdallah dated 17 July 2010.

The total length of the correspondence is 74,908 words. Here's how that length compares to some well-known novels:

Osama bin Laden's correspondence is about as long as the first Harry Potter book (which you may know as Harry Potter and the Sorcerer's Stone on the left side of the pond).

I also compared the reading level of the (and I stress, translated) text using the Flesch-Kincaid formula, which must be taken with a grain of salt since it sometimes gives weird results, like scoring Shakespeare below children's books:

It's about as hard to read as Mark Twain, so it's got that going for it, which is nice.

I also did a quick topic modelling using the NMF algorithm, which determines which words best separate the 103 documents into similar groups, or clusters. Here are the results, in no particular order; the topics were named by me, based on nothing but intuition.

Topic 1, "feminine and prayerful": god, peace, dear, praise, sister, blessing, mercy, willing, letter, prayer

Topic 2, "addressing those in power":  al, shaykh, brother, abu, letter,  wa, mahmud, muhammad, god, informed

Topic 3: "family and god":  allah, brother, mercy, ask, wa,  al, praise, father, child, know

Topic 4: "jihad":  god, said, people, ha, crusader,  jihad, nation, war, ye, islam

Topic 5: "Arab spring":  revolution, people, muslim, regime, ummah,  egypt, opportunity, blood, ruler, wa
Again, if you want to see my methodology, look here. Finally here are the bar graphs corresponding to the word clouds at the top of the post (click to enlarge):

Word clouds made with Tagxedo

Wednesday, May 13, 2015

Percentage of women in European national legislatures, 2014

Slovenia, Serbia and FYR Macedonia were kind of a surprise to me. Spain, too, a bit, and Belarus. Hungary, you got some explaining to do. France, vous me d├ęsappointez aussi.

As it does in every possible measure of national success, of course, Scandinavia rocks.

Mostly, this was a chance to take my hex grid chloropleth of Europe out for a spin!

Thursday, May 7, 2015

Most characteristic words in pro- and anti-feminist tweets

 Here are, based on my analysis (which I'll get to in a moment) clouds of the 40 words most characteristic of anti-feminist and pro-feminist tweets, respectively.


Word clouds my may be only semi-quantitative but they have other virtues, like recognizability and explorability. For the purists, there's a bar chart below.

I'll mostly talk about my results here; the full methodology is available on my other, nerdier blog, which links to all the code so you can reproduce this analysis yourself, if you so desire. (We call ourselves data scientists, and science is supposed to be reproducible, so I strongly believe I should empower you to reproduce my results if you want ... or improve on them!) Please also read the caveats I've put at the bottom of this post.

Full disclosure: I call myself a feminist. But I believe my only agenda is to elucidate the differences in vocabulary that always happen around controversial topics. As CPG Grey explains brilliantly, social networks of ideologically polarized groups like republicans and democrats or atheists and religious people mostly interact within the group, only rarely participating in a rapprochement or (more likely) flame war with the other side. This is fertile ground for divergent vocabulary, especially in this case when one group defines itself as opposed to the other (as if democrats called themselves non-republicans). I am not going into this project with a pro-feminist agenda, but of course I acknowledge I am biased. I worked hard to try to counter those biases, and I've made the code available for anyone to check my work. Feel free to disagree!

A brief (for me) description of the project: In January, I wrote a constantly running program that periodically searches the newest tweets for the terms 'feminism', 'feminist' or 'feminists' (and random intervals and random depth, potentially as often as 1500 tweets within 15 minutes), and collected almost 1,000,000 tweets up to April 2015. Then with five teammates (we won both the Data Science and the Natural Language Processing prizes at the Montreal Big Data Week Hackathon on April 19, 2015), We manually curated 1,000 tweets as anti-feminist, pro-feminist or neither (decidedly not an obvious process, read more about it here). We used machine learning to classify the other 390,000 tweets (after we eliminated retweets and duplicates, anything that required only clicking instead of typing), then used the log-likelihood keyness method to find which words (or punctuation marks, etc.) were overrepresented the most in each set.

And here are my observations:

1. Pro-feminists (PFs) tweet about feminism and feminist (adjective), anti-feminists (AFs) tweet about feminists, as a group.
Since they're search terms so at least one of those words was in every tweet, their absolute log-likelihood values are inflated so I left them out of the word clouds. However, the differences between them are valid, and instructive. (But see the caveats below) AFs seem to be more concerned with feminists as a collective noun (they tweetabout the people they oppose, not the movement or ideology), while PFs tweet about feminism or feminist (usually as an adjective).
2. PFs use first- and second-person pronouns, AFs use third-person pronouns
Similarly to #1 above, and inevitably when one group defines itself as not belonging to the other, AFs tweet about feminists as a plural group of other people, while feminists tweet about and among themselves. Note that in NLP, usually pronouns are so common they're considered "stopwords", and are eliminated from the analysis. But with 140-character tweets, I figured every word was chosen with a certain amount of care.
3. The groups use different linking words to define feminism
PFs talk about what feminism is for or about, why we need feminism, what feminism is and isn't, what feminists believe; AFs tweet about what feminists want, ask can someone explain why feminists engage in certain behaviors which they don't get, say feminists are too <insert adjective>, and often use the construction With <this, then that>.
4. PFs link to external content, AFs link to local and self-created content.
PFs link more in general to http content via other websites; AFs use the #gamergate hashtag, reference @meninisttweet,  and link to @youtube videos rather than traditional media (that term doesn't appear in the word cloud, but it has a log-likelihood of 444 in favor or AFs). AFs also reference their platform, Twitter, a lot; feminists don't, presumably because they're also interacting in other ways.
5. AFs use more punctuation
Besides "feminists", the number-one token for AFs was the question mark; they have a lot of questions for and about feminists, many of them rhetorical. The exclamation point wasn't far behind, followed by the quotation mark, both to quote and to show irony. PFs start tweets with '+' and "=" (usually as '==>') for emphasis. Rounding out the non-alphabetic characters, AFs use 2 as a shorter form of 'to' or 'too', while PFs link more often to listicles with 5 items.
6. AFs tweet more about feminist history.
Unsurprisingly, PFs tweet about their goals, equality and rights, and defend themselves against accusations of misandry. But it's the AFs who tweet about modern and third-wave feminism, displaying knowledge about the history of the movement.
7. PFs use more gender-related terms
This one is all PF: they reference gender, genders, sexes, men and women more than AFs.
8. AFs use more pejorative terms
AFs use fuck, hate, annoying and, unfortunately, rape a lot; they also use derisive terms like lol, the "face with tears of joy" emoji and smh (shaking my head, not in the top 40 but still a high log-likelihood value of 484).
  • Selection bias: the dataset does not include any tweets with pro- or anti-feminist sentiment that do not include the search terms 'feminist', 'feminists' or 'feminism'
  • Noise in the signal, part 1. It's difficult to analyze tweets for the underlying attitude (pro- or anti-feminism) of the author; it involves some mind-reading. We tried to mitigate this by using a "neither pro nor anti" category classifying tweets we had the slightest doubt of thusly. Of course, that just shifts the noise elsewhere, but hopefully keeps down the misclassifications between our two groups of interest, pro- and anti-
  • Noise in the signal, part 2. We used 1,000 tweets to predict the attitudes of 390,000 tweets. Obviously this is going to be an imperfect mapping of tweet to underlying attitude. This kind of analysis does not require anywhere near 100% accuracy (we got between 40% and 60%, depending on the metric, both of which are better than random choice, which would give 33%). The log-likelihood method is robust, and will tend to eliminate misclassified words. In other words, we may not be confident these top 40 words and tokens are the same top 40 words and tokens that would result if we manually curated all 390,000 tweets, but we are confident these top 40 words and tokens are significantly characteristic of the two groups we identified in our curated tweets.
  • If you have doubts as to my methods or results, great, that's what science is all about. Please feel free to analyze the code, the dataset, the manual curation, and the log-likelihood results linked to in my other blog.
  • It is not my goal to criticize or mock anti-feminists, and I hope I've kept my tone analytical. There's a Venn diagram between stuff feminists say (and of course they don't all say anywhere near the same thing), stuff anti-feminists say, and things I agree with, and it's not straightforward. What interested me here was the language. That said, I hope I've contributed a little bit to understanding the vocabulary surrounding the issue, and in general, I believe more knowledge is better than less knowledge.
Word clouds made with Tagxedo.

Popular Posts

Scroll To Top