tidy text
play

TIDY TEXT Jeff Goldsmith, PhD Department of Biostatistics 1 Text - PowerPoint PPT Presentation

TIDY TEXT Jeff Goldsmith, PhD Department of Biostatistics 1 Text data Written information Sentences Tweets Descriptions Books Stored as strings Made up of tokens, which is a meaningful unit of text Words;


  1. TIDY TEXT Jeff Goldsmith, PhD Department of Biostatistics � 1

  2. Text data • Written information – Sentences – Tweets – Descriptions – Books • Stored as strings • Made up of “tokens”, which is a meaningful unit of text – Words; sentences; paragraphs; etc � 2

  3. Tidy text • Need to organize text data around tokens – If your data contain whole tweets as a variable and your tokens are words, your data aren’t “tidy” – “Un-nesting” is a common step • Once you have tidy text data, you need to analyze it • The tidytext package contains useful tools � 3

  4. Words • Stop words are common but don’t contain information – “the”, “of”, “and”, etc. tidytext has a dataset of stop words called stop_words • • Remove these from your tidy text data using an anti-join • Word frequency is often very informative – Count words in tidy text datasets using group_b y and summarize � 4

  5. Relative frequencies • Comparisons across groups are often informative • Word counts alone may be misleading – group sizes may differ • If only there were a way to see if words were more likely to appear in one group than in another group … • Odds ratios! Yay! • We’ll use an approximate odds ratio, which guards against division-by-zero for uncommon words � 5

  6. Sentiments • Words convey sentiments – “Happy” is a happy word :-) – “Sad” is a sad word :-( • Lexicons can map words to the sentiments they convey – tidytext contains several sentiment lexicons – Join to a tidy text dataset using joins – Construct overall score for a sentence / phrase by aggregating across individual words � 6

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend