Skip to main content

Classification

  • Chapter
  • First Online:
Text Analysis with R

Abstract

This chapter introduces machine classification in the context of an authorship attribution problem. Various methods of text pre-processing are combined here to generate a corpus of 430 text samples. These samples are then used for training and testing a support vector machines supervised learning model.

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info
Hardcover Book
USD 89.99
Price excludes VAT (USA)
  • Durable hardcover 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

Notes

  1. 1.

    We know what you are thinking: there are 26 letters so what if you want an odd number of groups, like five? The cut function described here will optimize the size of the segments to be as close to equal as possible based on the length of the input vector.

  2. 2.

    Or some other number that is less than or equal to the length of the vector you are iterating over.

  3. 3.

    In regex the period character is used as a special wild card. So in this expression the first period must be escaped using the double backslashes. This tells the regex engine to find the literal period. The second period in the expression is the period being used as a wild card metacharacter. The asterisk is another special character that is used as a multiplier. So here the asterisk repeats the wild card character indefinitely, until the end of the search string is reached.

  4. 4.

    We say “or so” because the time it takes to complete this operation is dependent on your computer’s processor and the configuration of your system. On our MacBook Pro it took 14.19 s.

  5. 5.

    There are many good classification algorithms that can be used for authorship attribution testing, see, for example, Jockers and Witten (2010). In this paper, Jockers and Witten conclude that the Nearest Shrunken Centroids is especially good for authorship attribution problems, but frankly, the others methods tested also performed quite well. Interested readers might also look at the work of Jan Rybicki and Maciej Eder found at the Computational Stylistics Group website: https://sites.google.com/site/computationalstylistics/.

References

Download references

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2020 Springer Nature Switzerland AG

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

L. Jockers, M., Thalken, R. (2020). Classification. In: Text Analysis with R. Quantitative Methods in the Humanities and Social Sciences. Springer, Cham. https://doi.org/10.1007/978-3-030-39643-5_16

Download citation

Publish with us

Policies and ethics