declarative multilingual information extraction with systemt

25
SystemT: Declarative Information Extraction Laura Chiticariu, IBM Research Cognitive Systems Institute Speaker Series 11/17/2016

Upload: diannepatricia

Post on 11-Jan-2017

92 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Declarative Multilingual Information Extraction with SystemT

SystemT: Declarative Information Extraction

Laura Chiticariu, IBM Research

Cognitive Systems Institute Speaker Series11/17/2016

Page 2: Declarative Multilingual Information Extraction with SystemT

• Use cases

• Requirements

• SystemT

• SystemT courses

Outline

Page 3: Declarative Multilingual Information Extraction with SystemT

Case Study 1: Sentiment Analysis

Text Analytics

Product catalog, Customer Master Data, …

Social Media

• Products Interests 360o Profile

• Relationships• Personal

Attributes

• Life Events

Statistical Analysis,

Report Gen.

Bank623%

Bank520%

Bank421%

Bank35%

Bank215%

Bank115%

Scale500M+ tweets a day, 100M+ consumers, …

BreadthBuzz, intent, sentiment, life events, personal atts, …

ComplexitySarcasm, wishful thinking, …

Page 4: Declarative Multilingual Information Extraction with SystemT

Case Study 2: Machine Analysis

Web Server Logs

Custom Application

Logs

Database Logs

Raw Logs Parsed Log Records

Parse Extract

LinkageInformation

End-to-EndApplication

Sessions

Integrate

Graphical Models(Anomaly detection)

Ana

lyze

5 min 0.85Cause Effect Delay Correlation

10 min 0.62

Correlation Analysis

• Every customer has unique components with unique log record formats

• Need to quickly customize all stages of analysis for these custom log data sources

Page 5: Declarative Multilingual Information Extraction with SystemT

• Use cases

• Requirements

• SystemT

• SystemT courses

Outline

Page 6: Declarative Multilingual Information Extraction with SystemT

Expressivity• Needtoexpresscomplexalgorithmsforavarietyoftasksanddatasources

Scalability• Largenumberofdocumentsandlarge-sizedocuments

Transparency• Everycustomer’sdataandproblemsareuniqueinsomeway

• Needtoeasilycomprehend,debugandenhanceextractors

Enterprise Requirements

Page 7: Declarative Multilingual Information Extraction with SystemT

Expressivity Example: Different Kinds of Parses

We are raising our tablet forecast.

S

areNP

We

S

raising NP

forecastNP

tablet

DET

our

subjobj

subj pred

Natural Language Machine Log

Dependency Tree

Oct 1 04:12:24 9.1.1.3 41865: %PLATFORM_ENV-1-DUAL_PWR: Faulty internal power supply B detected

Time Oct 1 04:12:24

Host 9.1.1.3

Process 41865

Category %PLATFORM_ENV-1-DUAL_PWR

Message Faulty internal power supply B detected

Page 8: Declarative Multilingual Information Extraction with SystemT

Expressivity Example: Fact Extraction (Tables)

8

Singapore 2012 Annual Report(136 pages PDF)

Identify note breaking down Operating expenses line item, and extract opex components

Identify line item for Operating expenses from Income statement (financial table in pdf document)

Page 9: Declarative Multilingual Information Extraction with SystemT

• Social Media: Twitter alone has 500M+ messages / day; 1TB+ per day

• Financial Data: SEC alone has 20M+ filings, several TBs of data, with documents range from few KBs to few MBs

• Machine Data: One application server under moderate load at medium logging level à1GB of logs per day

Scalability Example

Page 10: Declarative Multilingual Information Extraction with SystemT

Transparency Example: Need to incorporate in-situ data

Intel's 2013 capex is elevated at 23% of sales, above average of 16%

FHLMC reported $4.4bn net loss and requested $6bn in capital from Treasury.

I'm still hearing from clients that Merrill's website is better.

Customer or competitor?

Good or bad?

Entity of interest

I need to go back to Walmart, Toys R Us has the same toy $10 cheaper!

Page 11: Declarative Multilingual Information Extraction with SystemT

• Use cases

• Requirements

• SystemT

• SystemT courses

Outline

Page 12: Declarative Multilingual Information Extraction with SystemT

AQL Language

Optimizer

OperatorRuntime

Specify extractor semantics declaratively

Choose efficient execution plan that implements semantics

Example AQL Extractor

Fundamental Results & Theorems• Expressivity: TheclassofextractiontasksexpressibleinAQLisastrictsupersetofthatexpressiblethroughcascadedregularautomata.

• Performance: Foranyacyclictoken-basedfinitestatetransducerT,thereexistsanoperatorgraphG suchthatevaluatingT andG hasthesamecomputationalcomplexity.

create view PersonPhone asselect P.name as person, N.number as phonefrom Person P, PhoneNum N, Sentence Swhere

Follows(P.name, N.number, 0, 30)and Contains(S.sentence, P.name)and Contains(S.sentence, N.number)and ContainsRegex( /\b(phone|at)\b/ ,

SpanBetween(P.name, N.number) );

Within a single sentence

<Person> <PhoneNum>0-30 chars

Contains “phone” or “at”

Within a single sentence

<Person> <PhoneNum>0-30 chars

Contains “phone” or “at”

Morethan35papersacrossACL,EMNLP,VLDB,PODSandSIGMOD

SystemT: IBM Research project started in 2006SystemT Architecture

Page 13: Declarative Multilingual Information Extraction with SystemT

package com.ibm.avatar.algebra.util.sentence;

import java.io.BufferedWriter;import java.util.ArrayList;import java.util.HashSet;import java.util.regex.Matcher;

public class SentenceChunker{private Matcher sentenceEndingMatcher = null;

public static BufferedWriter sentenceBufferedWriter = null;

private HashSet<String> abbreviations = new HashSet<String> ();

public SentenceChunker (){

}

/** Constructor that takes in the abbreviations directly. */public SentenceChunker (String[] abbreviations){

// Generate the abbreviations directly.for (String abbr : abbreviations) {this.abbreviations.add (abbr);

}}

/*** @param doc the document text to be analyzed* @return true if the document contains at least one sentence boundary*/public boolean containsSentenceBoundary (String doc){

String origDoc = doc;

/** Based on getSentenceOffsetArrayList()*/

// String origDoc = doc;// int dotpos, quepos, exclpos, newlinepos;int boundary;int currentOffset = 0;

do {

/* Get the next tentative boundary for the sentenceString */setDocumentForObtainingBoundaries (doc);boundary = getNextCandidateBoundary ();

if (boundary != -1) {doc.substring (0, boundary + 1);String remainder = doc.substring (boundary + 1);

String candidate = /** Looks at the last character of the String. If this last * character is part of an abbreviation (as detected by* REGEX) then the sentenceString is not a fullSentence and * "false” is returned*/// while (!(isFullSentence(candidate) &&// doesNotBeginWithCaps(remainder))) {while (!(doesNotBeginWithPunctuation (remainder)

&& isFullSentence (candidate))) {

/* Get the next tentative boundary for the sentenceString */int nextBoundary = getNextCandidateBoundary ();if (nextBoundary == -1) {break;

}boundary = nextBoundary;candidate = doc.substring (0, boundary + 1);remainder = doc.substring (boundary + 1);

}

if (candidate.length () > 0) {// sentences.addElement(candidate.trim().replaceAll("\n", "// "));// sentenceArrayList.add(new Integer(currentOffset + boundary// + 1));// currentOffset += boundary + 1;

// Found a sentence boundary. If the boundary is the last// character in the string, we don't consider it to be// contained within the string.int baseOffset = currentOffset + boundary + 1;if (baseOffset < origDoc.length ()) {// System.err.printf("Sentence ends at %d of %d\n",// baseOffset, origDoc.length());return true;

}else {return false;

}}// origDoc.substring(0,currentOffset));// doc = doc.substring(boundary + 1);doc = remainder;

}}while (boundary != -1);

// If we get here, didn't find any boundaries.return false;

}

public ArrayList<Integer> getSentenceOffsetArrayList (String doc){ArrayList<Integer> sentenceArrayList = new ArrayList<Integer> ();

// String origDoc = doc;// int dotpos, quepos, exclpos, newlinepos;int boundary;int currentOffset = 0;sentenceArrayList.add (new Integer (0));

do {

/* Get the next tentative boundary for the sentenceString */setDocumentForObtainingBoundaries (doc);boundary = getNextCandidateBoundary ();

if (boundary != -1) {String candidate = doc.substring (0, boundary + 1);String remainder = doc.substring (boundary + 1);

/** Looks at the last character of the String. If this last character * is part of an abbreviation (as detected by REGEX) then the * sentenceString is not a fullSentence and "false" is returned*/// while (!(isFullSentence(candidate) &&// doesNotBeginWithCaps(remainder))) {while (!(doesNotBeginWithPunctuation (remainder) &&

isFullSentence (candidate))) {

/* Get the next tentative boundary for the sentenceString */int nextBoundary = getNextCandidateBoundary ();if (nextBoundary == -1) {break;

}boundary = nextBoundary;

candidate = doc.substring (0, boundary + 1);remainder = doc.substring (boundary + 1);

}

if (candidate.length () > 0) {sentenceArrayList.add (new Integer (currentOffset + boundary + 1));currentOffset += boundary + 1;

}// origDoc.substring(0,currentOffset));// doc = doc.substring(boundary + 1);

doc = remainder;}

}while (boundary != -1);

if (doc.length () > 0) {sentenceArrayList.add (new Integer (currentOffset + doc.length ()));

}

sentenceArrayList.trimToSize ();return sentenceArrayList;

}

private void setDocumentForObtainingBoundaries (String doc){

sentenceEndingMatcher = SentenceConstants.sentenceEndingPattern.matcher (doc);

}

private int getNextCandidateBoundary (){if (sentenceEndingMatcher.find ()) {return sentenceEndingMatcher.start ();

}elsereturn -1;

}

private boolean doesNotBeginWithPunctuation (String remainder){Matcher m = SentenceConstants.punctuationPattern.matcher (remainder);return (!m.find ());

}

private String getLastWord (String cand){Matcher lastWordMatcher = SentenceConstants.lastWordPattern.matcher (cand);if (lastWordMatcher.find ()) {return lastWordMatcher.group ();

}else {return "";

}}

/** Looks at the last character of the String. If this last character is * par of an abbreviation (as detected by REGEX)* then the sentenceString is not a fullSentence and "false" is returned*/private boolean isFullSentence (String cand){

// cand = cand.replaceAll("\n", " "); cand = " " + cand;

Matcher validSentenceBoundaryMatcher = SentenceConstants.validSentenceBoundaryPattern.matcher (cand);

if (validSentenceBoundaryMatcher.find ()) return true;

Matcher abbrevMatcher = SentenceConstants.abbrevPattern.matcher (cand);

if (abbrevMatcher.find ()) {return false; // Means it ends with an abbreviation

}else {// Check if the last word of the sentenceString has an entry in the// abbreviations dictionary (like Mr etc.)String lastword = getLastWord (cand);

if (abbreviations.contains (lastword)) { return false; }

}

return true;}

}

Java Implementation of Sentence Boundary Detection

Expressivity: AQL vs. Custom Java Code

create dictionary AbbrevDict from file'abbreviation.dict’;

create view SentenceBoundary asselect R.match as boundaryfrom ( extract regex /(([\.\?!]+\s)|(\n\s*\n))/

on D.text as match from Document D ) Rwhere

Not(ContainsDict('AbbrevDict', CombineSpans(LeftContextTok(R.match, 1),R.match)));

Equivalent AQL Implementation

Page 14: Declarative Multilingual Information Extraction with SystemT

Expressivity: Rich Set of Operators

Deep Syntactic Parsing ML Training & Scoring

Core Operators

Tokenization Parts of Speech Dictionaries

Semantic Role Labels

Language to express NLP Algorithms à AQL

….Regular Expressions

HTML/XML Detagging

Span Operations

Relational Operations

AggregationOperations

Page 15: Declarative Multilingual Information Extraction with SystemT

Expressivity: Multilingual Supportcreate dictionary PurchaseVerbs as('buy.01', 'purchase.01', 'acquire.01', 'get.01');

create view Relation asselect A.verb as BUY_VERB, R2.head as PURCHASE, A.polarity as WILL_BUYfrom Action A, Role R where

MatchesDict('PurchaseVerbs', A.verbClass); and Equals(A.aid, R.aid) and Equals(R.type, 'A1');

ACL‘15,‘16,EMNLP‘16,COLING‘16

• Parsing all languages into same predicate argument structure (language-independent)

• Common predicate argument structure surfaced in AQL

Page 16: Declarative Multilingual Information Extraction with SystemT

Scalability: Class of Optimizations in SystemT• Rewrite-based: rewrite algebraic operator graph

– Shared Dictionary Matching– Shared Regular Expression Evaluation– Regular Expression Strength Reduction– On-demand tokenization

• Cost-based: relies on novel selectivity estimation for text-specific operators– Standard transformations

• E.g., push down selections– Restricted Span Evaluation

• Evaluate expensive operators on restricted regions of the document

16

Tokenization overhead is paid only once

Person

(followed within 30 tokens)

Plan C

Plan AJoin

Phone

Restricted Span Evaluation

Plan B

Person Identify Phone startingwithin 30 tokensExtract text to the right

PhoneIdentify Person ending within 30 tokens Extract text to the left

Page 17: Declarative Multilingual Information Extraction with SystemT

Transparency in SystemT

PersonPhone

• Clear and simple provenance à

Person PhonePersonAnna at James St. office (555-5555) ….

[Liu et al., VLDB’10]

Ease of comprehensionEase of debuggingEase of enhancement

• Explains output data in terms of input data, intermediate data, and the transformation• For predicate-based rule languages (e.g., SQL), can be computed automatically

create view PersonPhone asselect P.name as person, N.number as phonefrom Person P, PhoneNum Nwhere Follows(P.name, N.number, 0, 30);

person phone

Anna 555-5555

James 555-5555

Person

name

Anna

James

Phone

number

555-5555t1t2

t3

t1 Ù t3

t2 Ù t3

Page 18: Declarative Multilingual Information Extraction with SystemT

Web Tools OverviewEase of

Programming

Ease ofSharing

Page 19: Declarative Multilingual Information Extraction with SystemT

• Use cases

• Requirements

• SystemT

• SystemT courses

Outline

Page 20: Declarative Multilingual Information Extraction with SystemT

SystemT in Universities

2013 2015 2016 2017• UC Santa Cruz

(full Graduate class)

2014• U. Washington (Grad)• U. Oregon (Undergrad)• U. Aalborg, Denmark (Grad)• UIUC (Grad)

• U. Maryland Baltimore County (Undergrad)

• UC Irvine (Grad)

• NYU Abu-Dhabi (Undergrad)• U. Washington (Grad)• U. Oregon (Undergrad)• U. Maryland Baltimore County

(Undergrad)• …

• UC Santa Cruz, 3 lectures in one Grad class

SystemT MOOC

Page 21: Declarative Multilingual Information Extraction with SystemT

Alon Halevy, November 2015

"The tutorial of System T was an important hands-on component of a Ph.D course on Structured Data on the Web at the University of Aalborg in Denmark taught by Alon Halevy. The tutorial did a great job giving the students the feeling for the challenges involved in extracting structured data from text.“

Shimei Pan, University of Maryland, Baltimore County, May 2016

"The Information Extraction with SystemT class, which was offered for the first time at UMBC, has been a wonderful experience for me and my students. I really enjoyed teaching this course. Students were also very enthusiastic. Based on the feedback from my students, they have learned a lot. Some of my students even want me to offer this class every semester.“

SystemT in Universities: Testimonials

Page 22: Declarative Multilingual Information Extraction with SystemT

• Professors like teaching it

• Students do interesting projects and have fun!• Identify character relationships in Games of Thrones• Determine the cause and treatment for PTSD patients• Extract job experiences and skills from resumes• …

SystemT in Universities: Summary

Page 23: Declarative Multilingual Information Extraction with SystemT

SystemT MOOC

Bring SystemT to 100,000+ students

Target Audience: NLP Engineer, Data Scientiste.g., University students (grad, undergrad), industry professionals

Learning Path with two classesTA0105: Text Analytics: Getting Results with SystemT

• Basics of IE with SystemT, learning to write extractors using the web tool, learn AQL• 5 lectures + 1 hands-on lab + final exam

TA0106EN: Advanced Text Analytics: Getting Results with SystemT• Advanced material on declarative approach and SystemT optimization• 2 lectures + final exam

Page 24: Declarative Multilingual Information Extraction with SystemT

Summary

create view Company asselect ...from ...where ...

create view SentimentFeaturesasselect …from …;

AQL ExtractorsAQL Extractors

Embedded machine learning model

AQL Rules

create view SentimentForCompany asselect T.entity, T.polarityfrom classifyPolarity (SentimentFeatures) T;

create view Company asselect ...from ...where ...

create view SentimentFeaturesasselect …from …;

AQL ExtractorsAQL Extractors

Embedded machine learning model

AQL Rules

AQL ExtractorsAQL Extractors

Embedded machine learning model

Embedded machine learning model

AQL Rules

create view SentimentForCompany asselect T.entity, T.polarityfrom classifyPolarity (SentimentFeatures) T;

Declarative AQL languageDevelopment Environment

Cost-based optimization. .

.

Discovery tools for AQL development

SystemT Runtime

Input Documents

ExtractedObjects

AQL: a declarative language that can be used to build extractors outperforming the state-of-the-art [ACL’10, EMNLP’10, PODS’13,PODS’14,EMNLP Tutorial’15]Multilingual: [ACL’15,ACL’16,EMNLP’16,COLING’16]

A suite of novel development tooling leveraging machine learning and HCI [EMNLP’08, VLDB’10, ACL’11, CIKM’11, ACL’12, EMNLP’12, CHI’13, SIGMOD’13, ACL’13,VLDB’15, NAACL’15]

Cost-based optimization for text-centric operations

[ICDE’08, ICDE’11, FPL’13, FPL’14]

Highly embeddable runtime with high-throughput and small memory footprint.

[SIGMOD Record’09, SIGMOD’09]

A declarative information extraction system with cost-based optimization, high-performance runtimeand novel development tooling based on solid theoretical foundation [PODS’13, 14]. Shipping with 10+ IBM products, and installed on 400+ client’s sites.

InfoSphere Streams

InfoSphere BigInsights

SystemTSystemT

IBM Engines

Page 25: Declarative Multilingual Information Extraction with SystemT

Find out more about SystemT !

https://ibm.biz/BdF4GQ

Try out SystemT

Watch a demo

Learn about using SystemT in unversity courses