With the upcoming European Elections within sight, it is a good idea to check out the different election manifestos of the participating parties. While everybody can simply read the corresponding documents, it is an interesting task to create a distance view on the various political topics of the different election manifestos using some automated language analysis.
In the following, the focus is set on the election manifestos of those parties that managed to obtain at least one seat in the previous 2014 European Parliament election in Germany. This includes: CDU/CSU, SPD, B'90/Grünen, Linke, AfD, FDP, Freie Wähler, Piraten, Tierschutzpartei, NPD, Familie, ÖDP, Partei.
Let's proceed with the analysis. First, the election manifestos of the selected parties are downloaded. For all parties a corresponding .pdf file can be obtained, except for the NPD, which only offers a corresponding webpage with information.
Subsequently, the .pdf files are converted to plain text using the
command-line tool, which is part of XpdfReader.
For the NPD, simply the text of the webpage is copied to a corresponding .txt
To get rid of the uninteresting parts, the Python Natural Language Toolkit module is applied to remove, stop words and punctuations; besides, all words are lowered and lemmatized. Apart from that only verbs, adverbs, nouns and adjectives are kept.
For a nice presentation of the extracted words, the Python word cloud generator module is used in combination with a mask of each used party logo.
As a result, the following thirteen word clouds are obtained:
Although the created word clouds provide a nice overview of the different election manifestos, the used approach has some limitations: For example, the extent of the election manifestos differs from party to party so that word cloud comparisons must be carefully handled.
For a detailed overview, I strongly recommend to examine the corresponding election manifestos for further information.
The most important at end: Go Vote!.