Using Language Models for Classifying the Party Affiliation of Political Texts | SpringerLink
Skip to main content

Using Language Models for Classifying the Party Affiliation of Political Texts

  • Conference paper
  • First Online:
Natural Language Processing and Information Systems (NLDB 2022)

Abstract

We analyze the use of language models for political text classification. Political texts become increasingly available and language models have succeeded in various natural language processing tasks. We apply two baselines and different language models to data from the UK, Germany, and Norway. Observed accuracy shows language models improving on the performance of the baselines by up to 10.35% (Norwegian), 12.95% (German), and 6.39% (English).

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
¥17,985 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
JPY 3498
Price includes VAT (Japan)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
JPY 11439
Price includes VAT (Japan)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
JPY 14299
Price includes VAT (Japan)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

Notes

  1. 1.

    The Treaty of the European Union states that “Every citizen shall have the right to participate in the democratic life of the Union. Decisions shall be taken as openly and as closely as possible to the citizen.” (see http://data.europa.eu/eli/treaty/teu_2016/art_10/oj).

  2. 2.

    https://www.theyworkforyou.com/.

  3. 3.

    https://data.mendeley.com/datasets/czjfwgs9tm/2.

  4. 4.

    We use the MultinomialNB classifier, remove stopwords (Norwegian/German/English), use n-grams from 1 to 4. We determine the best hyperparameter configuration with grid search over maximum number of features \( \{30k, 50k, 100k\} \) and the learning rate \( \alpha \in \{0.01, 0.1, 0.5, 1.0 \} \). For the NPSC data, we use 30000 features and \( \alpha = 0.01 \). For the GPSC data, we use 100000 features and \( \alpha = 0.1 \). For the ParlVote data, we use 100000 features and \( \alpha = 0.01 \).

  5. 5.

    https://huggingface.co.

  6. 6.

    https://github.com/google-research/bert.

  7. 7.

    https://github.com/NBAiLab/notram.

  8. 8.

    https://huggingface.co/bert-base-german-cased.

  9. 9.

    https://huggingface.co/bert-base-cased.

  10. 10.

    https://www.ntnu.edu/norwai/new-language-models-in-norwai.

  11. 11.

    https://huggingface.co/dbmdz/german-gpt2.

  12. 12.

    https://huggingface.co/gpt2.

  13. 13.

    https://scikit-learn.org/stable/modules/generated/sklearn.utils.class_weight.compute_class_weight.html.

  14. 14.

    https://github.com/doantumy/LM_for_Party_Affiliation_Classification.

References

  1. Abercrombie, G., Batista-Navarro, R.: ParlVote: a Corpus for sentiment analysis of political debates. In: Proceedings of the 12th Language Resources and Evaluation Conference. pp. 5073–5078. European Language Resources Association (2020). https://aclanthology.org/2020.lrec-1.624

  2. Baly, R., Da San Martino, G., Glass, J., Nakov, P.: We can detect your bias: predicting the political ideology of news articles. In: Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 4982–4991 (2020). https://doi.org/10.18653/v1/2020.emnlp-main.404

  3. Biessmann, F., Lehmann, P., Kirsch, D., Schelter, S.: Predicting political party affiliation from text. PolText 14, 14 (2016)

    Google Scholar 

  4. Dahllöf, M.: Automatic prediction of gender, political affiliation, and age in Swedish politicians from the wording of their speeches—a comparative study of classifiability. Liter. Linguist. Comput. 27(2), 139–153 (2012). https://doi.org/10.1093/llc/fqs010

    Article  Google Scholar 

  5. Devlin, J., Chang, M.W., Lee, K., Toutanova, K.: BERT: pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805 (2018). https://doi.org/10.18653/v1/N19-1423

  6. Høyland, B., Godbout, J.F., Lapponi, E., Velldal, E.: Predicting party affiliations from European parliament debates. In: Proceedings of the ACL 2014 Workshop on Language Technologies and Computational Social Science, pp. 56–60 (2014)

    Google Scholar 

  7. Kummervold, P.E., De la Rosa, J., Wetjen, F., Brygfjeld, S.A.: Operationalizing a national digital library: the case for a Norwegian transformer model. In: Proceedings of the 23rd Nordic Conference on Computational Linguistics (NoDaLiDa), pp. 20–29 (2021). https://aclanthology.org/2021.nodalida-main.3

  8. Luong, M.T., Kayser, M., Manning, C.D.: Deep neural language models for machine translation. In: Proceedings of the 19th Conference on Computational Natural Language Learning, pp. 305–309 (2015). https://doi.org/10.18653/v1/K15-1031

  9. Radford, A., et al.: Language models are unsupervised multitask learners. OpenAI blog 1(8), 9 (2019)

    Google Scholar 

  10. Rao, A., Spasojevic, N.: Actionable and political text classification using word embeddings and LSTM. arXiv preprint arXiv:1607.02501 (2016)

  11. Richter, F., et al.: Open Discourse (2020). https://doi.org/10.7910/DVN/FIKIBO

  12. Serban, I., Sordoni, A., Bengio, Y., Courville, A., Pineau, J.: Building end-to-end dialogue systems using generative hierarchical neural network models. In: Proceedings of the AAAI Conference on Artificial Intelligence, vol. 30 (2016)

    Google Scholar 

  13. Solberg, P.E., Ortiz, P.: The Norwegian parliamentary speech corpus. arXiv preprint arXiv:2201.10881 (2022)

  14. Sun, C., Qiu, X., Xu, Y., Huang, X.: How to fine-tune BERT for text classification? In: Sun, M., Huang, X., Ji, H., Liu, Z., Liu, Y. (eds.) CCL 2019. LNCS (LNAI), vol. 11856, pp. 194–206. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-32381-3_16

    Chapter  Google Scholar 

  15. Wang, W., Shen, S., Li, G., Jin, Z.: Towards full-line code completion with neural language models. arXiv preprint arXiv:2009.08603 (2020)

  16. Wong, F.M.F., Tan, C.W., Sen, S., Chiang, M.: Quantifying political leaning from tweets, retweets, and retweeters. IEEE Trans. Knowl. Data Eng. 28(8), 2158–2172 (2016)

    Article  Google Scholar 

  17. Yu, B., Kaufmann, S., Diermeier, D.: Classifying party affiliation from political speech. J. Inf. Technol. Polit. 5, 33–48 (2008). https://doi.org/10.1080/19331680802149608

Download references

Acknowledgements

This work is done as part of the Trondheim Analytica project and funded under Digital Transformation program at Norwegian University of Science and Technology (NTNU), 7034 Trondheim, Norway.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Tu My Doan .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2022 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Doan, T.M., Kille, B., Gulla, J.A. (2022). Using Language Models for Classifying the Party Affiliation of Political Texts. In: Rosso, P., Basile, V., Martínez, R., Métais, E., Meziane, F. (eds) Natural Language Processing and Information Systems. NLDB 2022. Lecture Notes in Computer Science, vol 13286. Springer, Cham. https://doi.org/10.1007/978-3-031-08473-7_35

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-08473-7_35

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-08472-0

  • Online ISBN: 978-3-031-08473-7

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics