More Text Analytics National Center for Supercomputing Applications University of Illinois at Urbana-Champaign
Outline Concept Tracking –Emotion Tracking Topic Modeling Hands-On
Text Analytics: Concept Tracking Given: Set of documents Given: Set of concepts and related words Find the concepts in the set of documents using the related words and a synonym network Concepts can then be displayed with additional meta data from the documents for timeline, or GIS mapping Specific example is Emotion Tracking
Work – Emotion Tracking Goal is to have this type of Visualization to track emotions across a text document (Leveraging flare.prefuse.org)
Text Analytics: Emotion Tracking Sentiment Analysis
Classifying text based on its sentiment –Determining the attitude of a speaker or a writer –Determining whether a review is positive/negative Ask: What emotion is being conveyed within a body of text? –Look at only adjectives lots of issues and challenges Need to Answer: –What emotions to track? –How to measure/classify an adjective to one of the selected emotions? –How to visualize the results?
Sentiment Analysis: Emotion Selection Which emotions: – – %20emotions.htmhttp://changingminds.org/explanations/emotions/basic %20emotions.htm – mhttp:// m Parrot’s classification (2001) –six core emotions –Love, Joy, Surprise, Anger, Sadness, Fear
Sentiment Analysis: Emotions
Sentiment Analysis: Using Adjectives How to classify adjectives: –Lots of metrics we could use … Lists of adjectives already classified – ds/ewords.htmlhttp:// ds/ewords.html –Need a “nearness” metric for missing adjectives –How about the thesaurus game ?
Ontological Association (WordNet) As of 2006, the database contains about 150,000 words organized in over 115,000 synsets for a total of 207,000 word-sense pairs POSUnique Strings SynsetsTotal Strings Word-Sense Pairs Noun Verb Adjective Adverb Totals
Ontological Association (WordNet) Search for table Noun –S: (n) table, tabular array (a set of data arranged in rows and columns) "see table 1” –S: (n) table (a piece of furniture having a smooth flat top that is usually supported by one or more vertical legs) "it was a sturdy table” –S: (n) table (a piece of furniture with tableware for a meal laid out on it) "I reserved a table at my favorite restaurant” –S: (n) mesa, table (flat tableland with steep edges) "the tribe was relatively safe on the mesa but they had to descend into the valley for water” –S: (n) table (a company of people assembled at a table for a meal or game) "he entertained the whole table with his witty remarks” –S: (n) board, table (food or meals in general) "she sets a fine table"; "room and board” Verb –S: (v) postpone, prorogue, hold over, put over, table, shelve, set back, defer, remit, put off (hold back to a later time) "let's postpone the exam” –S: (v) table, tabularize, tabularise, tabulate (arrange or enter in tabular form)
Sentiment Analysis Using only a thesaurus, find a path between two words –no antonyms –no colloquialisms or slang
Sentiment Analysis For example, how would you get from delightful to rainy?
SEASR: Sentiment Analysis How to get from delightful to rainy ? ['delightful', 'fair', 'balmy', 'moist', 'rainy’] sexy to joyless? ['sexy', 'provocative', 'blue', 'joyless’] bitter to lovable? ['bitter', 'acerbic', 'tangy', 'sweet', 'lovable’]
SEASR: Sentiment Analysis Use this game as a metric for comparing a given adjective to one of the six emotions. Assume the longer the path, the “farther away” the two words are.
SEASR: Sentiment Analysis Introducing SynNet: a traversable graph of synonyms (adjectives)
Thesaurus Network (SynNet) Used thesaurus.com, create link between every term and its synonyms Created a large network Determine a metric to use to assign the adjectives to one of our selected terms –Is there a path? –How to evaluate best paths?
SynNet: rainy to pleasant
SynNet Metrics Path length Number of Paths Common nodes Symmetric: a b b a Unique nodes in all paths
SynNet Metrics: Path Length Rainy to Pleasant –Shortest path length is 4 (blue) Rainy, Moist, Watery, Bland, Pleasant –Green path has length of 3 but is not reachable via symmetry –Blue nodes are nodes 2 hops away
SynNet Metrics: Common Nodes Common Nodes –depth of common nodes Example –Top shows happy –Bottom shows delightful –Common nodes shown in center cluster
SynNet Metrics: Symmetry Symmetry of path in common nodes
SynNet: Sentiment Analysis Step 1: list your sentiments/concepts –joy, sad, anger, surprise, love, fear Step 2: for each concept, list adjectives –joy: joyful, happy, hopeful –surprise:surprising,amazing, wonderful, unbelievable Step 3: for each adjective in the text, calculate all the paths to each adjective in step 2 Step 4: pick the best adjective (using metrics)
SynNet: Sentiment Analysis Example: –the adjective incredible is more like which emotion
SynNet: Sentiment Analysis Incredible to loving (concept: love) Blue paths are symmetric paths
SynNet: Sentiment Analysis Incredible to surprising (concept: surprise) Blue paths are symmetric paths
SynNet: Sentiment Analysis Incredible to joyful (concept: joy)
SynNet: Sentiment Analysis Incredible to joyless (concept: sad)
SynNet: Sentiment Analysis Incredible to fearful (concept: fear)
SynNet: Sentiment Analysis Incredible to wonderful (concept: joy)
SynNet: Sentiment Analysis Try it yourself: – /synnet/path/white/afraid – /synnet/path/white/afraid?format=xml – /synnet/path/white/afraid?format=json – /synnet/path/white/afraid?format=flash –Database is only adjectives –More api coming soon, visualizations
Sentiment Analysis: Issues Not a perfect solution –still need context to get quality Vain –['vain', 'insignificant', 'contemptible', 'hateful'] –['vain', 'misleading', 'puzzling', 'surprising’] Animal –['animal', 'sensual', 'pleasing', 'joyful'] –['animal', 'bestial', 'vile', 'hateful'] –['animal', 'gross', 'shocking', 'fearful'] –['animal', 'gross', 'grievous', 'sorrowful'] Negation –“My mother was not a hateful person.”
Sentiment Analysis: Process Process Overview (2 flows) –Create Concept Cache & Ignore Cache Load the documents Extract the adjectives (POS analysis) Find the unique adjectives Label each adjective (SynNet Service) –Apply Concepts Load the document(s) Segment the document for single document Extract the adjectives (POS analysis) Summarize adjectives across segments or documents Visualize the concepts by segments
Sentiment Analysis: Visualization SEASR visualization component –Based on flash using the flare ActionScript Library – r/emotions.html
Sentiment Analysis: 911 Corpus Concepts for each story were identified as before Mapping was done by using additional meta- data for each story
Concept Mapping of an Author 5 books Charles Dickens 1.Tale of Two Cities 2.Great Expectations 3.Christmas Carol 4.Oliver Twist 5.David Copperfield
Concept Mapping for Multi Documents
Concept Mapping of a Single Document Tale of Two CitiesGreat Expectations
Concept Mapping of a Single Document
Concept Mapping: Creating Cache Files Two cache files –Concept cache Stores the word, concept, POS, seed word mapping and some numbers –greatjoyJJ031wonderful2 –anonymoussurpriseJJ3561unbelievable4 –darkfearJJ81502horrible2 –Ignore cache Stores the word that do not map to a concept
Concept Mapping: Create Cache Flow
Concept Mapping Notes If list of concepts and seed words have not changed, you can continue to use the same cache files for all documents. But you will need to change the cache file it you want to define new concept mappings. –E.g. Emotion Tracking: 6 concepts and their seed words –E.g. Positive/Negative: 2 concepts and seeds like (yes, yeah, ok, etc) (no, nay, not, etc) –E.g. Male/Female: 2 concepts and seeds like (he, his, him, mr, etc.) (she, her, mrs, etc.) Copy cache files to your machine for starters
Topic Modeling Uses Mallet Topic Modeling to cluster nouns from over 4000 documents from 19 th century with 10 segments per document Top 10 topics showing at most 200 keywords for that topic
Topic Modeling Process Load the documents Segment the documents Extract nouns (POS analysis) Create the Mallet data structures for each segment Mallet for topic modeling Save results Parse keyword results Create tagclouds of keywords
Demonstration Entity Extraction for timelines, maps, and social networks Concept Tracking –Emotion Tracking for single document –Emotion Tracking comparison for multiple documents Topic Modeling –Tagclouds of topic keywords
Learning Exercises Construct flow for performing entity extraction and review results. –Determine what you want to do with these results. Open the flow for tracking concepts –Modify the flow to load your data –Modify the flow to track concepts of interest to you
Attendee Project Plan Study/Project Title Team Members and their Affiliation Procedural Outline of Study/Project –Research Question/Purpose of Study –Data Sources –Analysis Tools Activity Timeline or Milestones Report or Project Outcome(s) Ideas on what your team needs from SEASR staff to help you achieve your goal. Identify Analytics
Discussion Questions What part of these applications can be useful to your research?