IDEAS home Printed from https://ideas.repec.org/a/tsj/stataj/v17y2017i4p866-881.html
   My bibliography  Save this article

Text mining with n-gram variables

Author

Listed:
  • Matthias Schonlau

    (University of Waterloo)

  • Nick Guenther

    (University of Waterloo)

  • Ilia Sucholutsky

    (University of Waterloo)

Abstract

Text mining is the process of turning free text into numerical variables and then analyzing them with statistical techniques. We introduce the command ngram, which implements the most common approach to text mining, the “bag of words”. An n-gram is a contiguous sequence of words in a text. Broadly speaking, ngram creates hundreds or thousands of variables, each recording how often the corresponding n-gram occurs in a given text. This is more useful than it sounds. We illustrate ngram with the categorization of text answers from two open-ended questions. Copyright 2016 by StataCorp LP.

Suggested Citation

  • Matthias Schonlau & Nick Guenther & Ilia Sucholutsky, 2017. "Text mining with n-gram variables," Stata Journal, StataCorp LP, vol. 17(4), pages 866-881, December.
  • Handle: RePEc:tsj:stataj:v:17:y:2017:i:4:p:866-881
    Note: to access software from within Stata, net describe http://www.stata-journal.com/software/sj17-4/st0502/
    as

    Download full text from publisher

    File URL: http://www.stata-journal.com/article.html?article=st0502
    File Function: link to article purchase
    Download Restriction: no
    ---><---

    Citations

    Citations are extracted by the CitEc Project, subscribe to its RSS feed for this item.
    as


    Cited by:

    1. Brown, Martin & Schmitz, Jan & Zehnder, Christian, 2024. "Communication and hidden action: A credit market experiment," Journal of Economic Behavior & Organization, Elsevier, vol. 218(C), pages 423-455.
    2. Muhammed-Fatih Kaya, 2022. "Pattern Labelling of Business Communication Data," Group Decision and Negotiation, Springer, vol. 31(6), pages 1203-1234, December.
    3. Cristina Cattaneo & Daniela Grieco & Nicola Lacetera & Mario Macis, 2024. "Out-group Penalties in Refugee Assistance: A Survey Experiment," NBER Working Papers 32139, National Bureau of Economic Research, Inc.
    4. Paul M. Anglin & Yanmin Gao, 2023. "Value of Communication and Social Media: An Equilibrium Theory of Messaging," The Journal of Real Estate Finance and Economics, Springer, vol. 66(4), pages 861-903, May.
    5. Christopher Haynes & Marco A. Palomino & Liz Stuart & David Viira & Frances Hannon & Gemma Crossingham & Kate Tantam, 2022. "Automatic Classification of National Health Service Feedback," Mathematics, MDPI, vol. 10(6), pages 1-23, March.

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:tsj:stataj:v:17:y:2017:i:4:p:866-881. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    We have no bibliographic references for this item. You can help adding them by using this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: Christopher F. Baum or Lisa Gilmore (email available below). General contact details of provider: http://www.stata-journal.com/ .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.