Making Words Work For You

Will Styler - World of Words


There’s a lot of language data out there.

* 1.3 billion active websites (Source)

* Mayo Clinic enters 298 million patient records per year (Source)

* 500 million Tweets per day (Source)

* 294 billion emails sent daily (Source)

… and that’s just the digital stuff


That’s a LOT of words


Today we’re going to talk about putting those words to work


Part 1

Counting Words for Fun and Profit


Words are used differently in different situations


“… by using these existing standards, we hope to be able to leverage new technologies during processing.”


A Question:


How can we answer this?


The Problem:

Humans are inefficient and expensive.




## The Solution


Let’s search some corpora!


Corpus (pl. Corpora): A collection of written or spoken texts assembled for the purpose of studying language


There are many different corpora out there.


The Brown Corpus

~2,000,000 words of English fiction, books, humor, textbooks, reporting, and gov’t docs


The Callhome Corpus

Transcripts of 120 phone conversations (18.3 hours of speech)


The Switchboard Corpus

2430 conversations (~3,000,000 words of text) from phone calls


The Broadcast News Corpus

~1,243,526 words transcribed from various broadcast news sources


The EnronSent Corpus

96,106 email messages (~13,000,000 words) from the Enron Corporate Email Servers


The Google Books Corpus

All the text from every book in the “Google Books” service


The Google Corpus

The entire internet. At your fingertips


The Lena Corpus

Thousands of hours of recorded child and child- directed speech


The Penn Treebank

A large corpus of syntactically marked data (showing the tree structure of sentences)


The Callhome Speech Corpus

This corpus actually contains sound files, useful for speech geeks like myself


(and many, many, many more)


So, that’s a bunch of data. How do you actually ask your question?



So, to find out if leveraging is corporate-speak, I want to look…


What would I need to look for?


How would I ask the computer to find that?

egrep "leverages|leveraging" yourcorpus


This gives you numbers!


“Leverage was used as a verb 61 times in the Enron corpus, and none at all in the equally large callhome corpus.”

Case Closed. Booyeah.


Counting word frequency is a very powerful tool!


n-Grams


What is an n-gram?



Enter Google Ngrams

https://books.google.com/ngrams


Eat


Sleep


Walk


Eat/Sleep/Walk


Some words, you might expect to change over time


Automobile


Computer


Laptop


Download


Google


Confederacy


Some words are falling out of use


Bilious


Blackguard


Retarded


Society is represented in distributions


Nazi


War


Color Terms


Sex


Let’s play a game!


Clue: Type of person (belonging to a certain group or culture)


Clue: Country


Clue: Home/Office Technology


Clue: Military Technology


Clue: Transportation Technology


Clue: Food Product


Warring Words


Vitriol vs. Sulfuric Acid


Aeroplane vs. Airplane


VHS vs. DVD


Handicapped vs. Disabled


Flammable vs. Inflammable


Unigrams are interesting!


Why?


These Probabilities tell us about language


These probabilities tell us about the world


n-grams are really useful


n-gram uses in the real world


Sociolinguistic n-gramming


… and all of this from counting words!


Part 2

Natural language processing is really useful


NLP - Natural Language Processing

Teaching computers to “understand” human language


Machine Learning in ∞ easy steps:


What kinds of tools are used?


Tokenizer

Breaks sentences into individual words


Part of Speech Taggers

Labels words with their grammatical functions


Syntactic Parser

This turns sentences into syntactic representations for analysis. ~~(ROOT (S (NP (DT This)) (VP (VBZ turns) (NP (NNS sentences)) (PP (IN into) (NP (NP (JJ syntactic) (NNS representations)) (PP (IN for) (NP (NN analysis)))))) (. .)))~~


Semantic Frame Annotations

“John boldly threw the stick at the polar bear.”


Coreference/Anaphora

“John boldly threw the stick at the polar bear. The beast cast it aside then enjoyed a snack.”


(and many, many more)


This kind of nuanced NLP is very, very useful


Analyzing Speech Data

“Ask people why they’re calling, and connect them to the right department based on their answer.”

“Flag all tech support conversations where the customer mentions a competitor”

“Redirect all angry-sounding customers to higher-tier support workers” (Speech emotion detection)

“Are the two people in this skype call flirting, arguing, expressing love, or sadness? Target post-session ads accordingly.”

“I want to talk to… billing?” (Uncertainty analysis)

“Yeah, I really like going to Applebees.” (Spot-the-sarcasm)


Data Aggregation

“Watch Twitter and give me the locations of wildfires, floods, etc, and provide information about damage, shelters and resources in an easy-to-read format” (EPIC)

“Read every news article about the Ukrainian Revolution and present the information on a cohesive timeline, with sources labeled.” (RED)

“Collect all case-law involving reverse mortgages in the state of Florida in which the plaintiff’s children filed suit against the mortgage company”


Authorship attribution and stylistic analysis

“Examine these two written passages/books and tell me whether they were both written by the same person” (Authorship Attribution Analysis)

“Examine these negative reviews and tell me what demographic the authors likely represent based on the language used.”

“Are these critical forum posts all written by the same person?”


Predictive analysis of text

“Look for any information in the newswire which will predict a change in this company’s stock price, then buy or sell stock automatically.”

“Based on this person’s Facebook post history, how likely is he to click an ad for weight-loss pills?”

“Based on all the political posts and tweets in Saginaw compared to those in Ann Arbor, how likely is this senator to lose in a recall election?”


Sentiment Analysis

“How often, in this corpus of blogs, do people say nice or awful things about product X?”

“We’ve just leaked a picture of our next supercar. How do people on twitter like the design?”

“What are people saying about our leaked $199.99 pricepoint?”

“How do people on these forums feel about 9/11?”


Language Pattern Detection

… or my personal favorite NLP task…


Temporal Analysis and Event Discovery


A Case Study

Many hospitals around the country are switching to Electronic Medical Records (EMRs).

These records are easily available within the institution, and contain lots of valuable data.

Creating timelines is incredibly time-consuming for humans, as is comparison.

What if machines could do this for us?

The THYME Project


“The patient developed a mild post-surgical rash, which was treated with hydrocortisone at the follow-up”


If a computer can be taught to interpret time in medical records, we can ask…


Temporal reasoning is important

Humans interpret time naturally, and make reference to it often.

Temporality interacts with causality in interesting ways.

Event detection and reasoning is useful in a variety of domains.

“What happened” is a very fundamental question that everybody wants answered.


NLP can be used to address answer any questions humans can answer!



… not so fast


Part 3

Why natural language processing is really hard.



No.

Not yours.


Natural Language is difficult at every level


Speech


No two people sound alike, even saying the same things


The right answer depends on the context and prosody.


“Bring me the bat, man”


“Bring me the Batman”


Speech recognition is spectacularly good, but nowhere near good enough.


Modality

Did something happen? Is it real?


Modality is difficult

“The compound might be bombed”

“If they attack, we’ll bomb the compound.”

“The general stated that bombing the compound overnight “was still an option””

“We may conduct a bombing at 0300”

“We will conduct a bombing at 0300”

“We conducted a bombing at 0300”


Coreference is difficult

“The Bay Harbor Butcher is off the streets, as Dexter Morgan, the alleged killer, was arrested by police over the weekend”

““Bill Clinton was the President of the United States in 1999. Now Barack Obama is POTUS.”


Metonymy

Using a word to refer to a practically or metaphorically related concept


Metonymy is difficult

“The terrorist built a pipe bomb

“The pipe bomb interrupted the festival”

200mg of Loperamide stopped her diarrhea”

Moscow condemned the latest round of sanctions”


Causality

Did one event trigger or cause the next event?


Causality is difficult

“The dam burst when the rockslide hit it.”

“The over-full dam burst when the rockslide hit it.”

“She pulled the trigger, firing the gun and killing the man.”

“She pulled the trigger, releasing the hammer, igniting the powder charge, launching the bullet and killing the man.”


Temporal Expressions

Words or phrases that indicate position in time


Temporal Expressions can be difficult

“The bombing occurred 2/13/12 at 0214”

“Next Tuesday, she’ll come in for a follow-up”

“She’s been having trouble sleeping lately.”

“She should expect soreness postoperatively.”

“TSA regulations have grown increasingly restrictive Post-9/11”


Temporal Relations

Linking and arranging different events as part of a greater timeline


“The patient developed a mild rash after surgery, which was treated at her follow up visit with hydrocortisone”


“The patient developed a mild rash after surgery, which was treated at her follow up visit with hydrocortisone, many years after Napoleon’s exile to Elba.”


NumRelations = (NumEvents)*(NumEvents)

100 Events == 10,000 valid Temporal Relations


Yikes.


… and language users hate us

“Gold covered the miner’s hands”/“Gold paid for the miner’s education”

“The Queen of England’s hat was purple”

“We gave the monkeys the bananas because they were ripe”

“We gave the monkeys the bananas because they were hungry”

“Time flies like an arrow, fruit flies like a banana”

“The old man returned to his house was happy”



Not yet.


## Hooray!


Final Conclusion


This presentation is available online at:

http://savethevowels.org/talks/ngrams_nlp_2018.html


Thank you!