A Tutorial - Knowledge Graph Construction from Text · 2018. 2. 5. · Tutorial Outline 1....
Transcript of A Tutorial - Knowledge Graph Construction from Text · 2018. 2. 5. · Tutorial Outline 1....
![Page 1: A Tutorial - Knowledge Graph Construction from Text · 2018. 2. 5. · Tutorial Outline 1. Knowledge Graph Primer [Jay] 2. Knowledge Extraction from Text a. ... Entity resolution,](https://reader036.fdocuments.in/reader036/viewer/2022071214/6043d985afeeb677752343a6/html5/thumbnails/1.jpg)
KnowledgeGraphConstructionfromTextAAAI2017
JAY PUJARA,SAMEER SINGH,BHAVANA DALVI
![Page 2: A Tutorial - Knowledge Graph Construction from Text · 2018. 2. 5. · Tutorial Outline 1. Knowledge Graph Primer [Jay] 2. Knowledge Extraction from Text a. ... Entity resolution,](https://reader036.fdocuments.in/reader036/viewer/2022071214/6043d985afeeb677752343a6/html5/thumbnails/2.jpg)
TutorialOverview
Part3:GraphConstruction
Part1:KnowledgeGraphs
Part4:CriticalAnalysis
Part2:KnowledgeExtraction
2
![Page 3: A Tutorial - Knowledge Graph Construction from Text · 2018. 2. 5. · Tutorial Outline 1. Knowledge Graph Primer [Jay] 2. Knowledge Extraction from Text a. ... Entity resolution,](https://reader036.fdocuments.in/reader036/viewer/2022071214/6043d985afeeb677752343a6/html5/thumbnails/3.jpg)
TutorialOutline1. KnowledgeGraphPrimer [Jay]
2. KnowledgeExtractionfromText
a. NLPFundamentals [Sameer]b. InformationExtraction [Bhavana]
CoffeeBreak
3. KnowledgeGraphConstructiona. ProbabilisticModels [Jay]b. EmbeddingTechniques [Sameer]
4. CriticalOverviewandConclusion [Bhavana]
3
![Page 4: A Tutorial - Knowledge Graph Construction from Text · 2018. 2. 5. · Tutorial Outline 1. Knowledge Graph Primer [Jay] 2. Knowledge Extraction from Text a. ... Entity resolution,](https://reader036.fdocuments.in/reader036/viewer/2022071214/6043d985afeeb677752343a6/html5/thumbnails/4.jpg)
WhatisKnowledgeExtraction?
4
John was born in Liverpool, to Julia and Alfred Lennon.Text
JohnLennon
AlfredLennon
JuliaLennon
Liverpoolbirthplace
childOf
childOf
LiteralFacts
![Page 5: A Tutorial - Knowledge Graph Construction from Text · 2018. 2. 5. · Tutorial Outline 1. Knowledge Graph Primer [Jay] 2. Knowledge Extraction from Text a. ... Entity resolution,](https://reader036.fdocuments.in/reader036/viewer/2022071214/6043d985afeeb677752343a6/html5/thumbnails/5.jpg)
NLPFundamentalsEXTRACTINGSTRUCTURESFROMLANGUAGE
![Page 6: A Tutorial - Knowledge Graph Construction from Text · 2018. 2. 5. · Tutorial Outline 1. Knowledge Graph Primer [Jay] 2. Knowledge Extraction from Text a. ... Entity resolution,](https://reader036.fdocuments.in/reader036/viewer/2022071214/6043d985afeeb677752343a6/html5/thumbnails/6.jpg)
WhatisNLP?
NLP
UnstructuredAmbiguousLotsandlotsofit!
Humanscanreadthem,but… veryslowly… can’trememberall… can’tanswerquestions
“Knowledge”
StructuredPrecise,ActionableSpecifictothetask
Canbeusedfordownstreamapplications,suchascreatingKnowledgeGraphs!
6
![Page 7: A Tutorial - Knowledge Graph Construction from Text · 2018. 2. 5. · Tutorial Outline 1. Knowledge Graph Primer [Jay] 2. Knowledge Extraction from Text a. ... Entity resolution,](https://reader036.fdocuments.in/reader036/viewer/2022071214/6043d985afeeb677752343a6/html5/thumbnails/7.jpg)
WhatisNLP?
John was born in Liverpool, to Julia and Alfred Lennon.
NaturalLanguageProcessing
NNP VBD VBD IN NNP TO NNP CC NNP NNP
John was born in Liverpool, to Julia and Alfred Lennon.Person Location Person Person
Lennon..JohnLennon...
Mrs.Lennon....hismother..
hisfatherAlfredhe
thePool
7
![Page 8: A Tutorial - Knowledge Graph Construction from Text · 2018. 2. 5. · Tutorial Outline 1. Knowledge Graph Primer [Jay] 2. Knowledge Extraction from Text a. ... Entity resolution,](https://reader036.fdocuments.in/reader036/viewer/2022071214/6043d985afeeb677752343a6/html5/thumbnails/8.jpg)
WhatisInformationExtraction?
JohnLennon
AlfredLennon
JuliaLennon
Liverpoolbirthplace
childOf
childOf
spouse
InformationExtraction
NNP VBD VBD IN NNP TO NNP CC NNP NNP
John was born in Liverpool, to Julia and Alfred Lennon.Person Location Person Person
Lennon..JohnLennon...
Mrs.Lennon....hismother..
hisfatherAlfredhe
thePool
8
![Page 9: A Tutorial - Knowledge Graph Construction from Text · 2018. 2. 5. · Tutorial Outline 1. Knowledge Graph Primer [Jay] 2. Knowledge Extraction from Text a. ... Entity resolution,](https://reader036.fdocuments.in/reader036/viewer/2022071214/6043d985afeeb677752343a6/html5/thumbnails/9.jpg)
BreakingitDown
John was born in Liverpool, to Julia and Alfred Lennon.NNP VBD VBD IN NNP TO NNP CC NNP NNP
John was born in Liverpool, to Julia and Alfred Lennon.Person Location Person Person
Lennon..JohnLennon...
Mrs.Lennon....hismother..
hisfatherAlfredhe
thePool
Senten
ce DependencyParsing,Partofspeechtagging,Namedentityrecognition…
Documen
t
Coreference Resolution...
JohnLennon
AlfredLennon
JuliaLennon
Liverpoolbirthplace
childOf
childOf
spouse
Inform
ation
Extractio
n
Entityresolution,Entitylinking,Relationextraction…
9
![Page 10: A Tutorial - Knowledge Graph Construction from Text · 2018. 2. 5. · Tutorial Outline 1. Knowledge Graph Primer [Jay] 2. Knowledge Extraction from Text a. ... Entity resolution,](https://reader036.fdocuments.in/reader036/viewer/2022071214/6043d985afeeb677752343a6/html5/thumbnails/10.jpg)
Tokenization&SentenceSplitting
UsesinKGConstruction:• StrictlyconstrainsotherNLPtasks
• PartsofSpeech• DependencyParsing
• DirectlyeffectsKGnodes/edges• Mentionboundaries• Relationswithinsentences
Howitisdone:• Regularexpressions,butnottrivial
• Mr.,Yahoo!,lower-case• Fornon-English,incrediblydifficult!
• Chinese:no“space”character• Non-trivialforsomedomains…
• Whatisa“token”inBioNLP?
“Mr.BobDobolina isthinkin'ofamasterplan. Whydoesn'thequit?”
[Mr.][Bob][Dobolina][is][thinkin’][of][a][master][plan][.][Why][doesn't][he][quit][?]
10
![Page 11: A Tutorial - Knowledge Graph Construction from Text · 2018. 2. 5. · Tutorial Outline 1. Knowledge Graph Primer [Jay] 2. Knowledge Extraction from Text a. ... Entity resolution,](https://reader036.fdocuments.in/reader036/viewer/2022071214/6043d985afeeb677752343a6/html5/thumbnails/11.jpg)
TaggingthePartsofSpeech
John was born in Liverpool, to Julia and Alfred Lennon.NNP VBD VBD IN NNP TO NNP CC NNP NNP
UsesinKGConstruction:• Entitiesappearasnouns• Verbsareveryuseful
• Foridentifyingrelations• Foridentifyingentitytypes
• ImportantfordownstreamNLP• NER,DependencyParsing,…
Howitisdone:• Contextisimportant!
• run,table, bar,…• Labelwholesentencetogether
• “Structuredprediction”• ConditionalRandomFields,..• Now:CNNs,LSTMs,…
11
![Page 12: A Tutorial - Knowledge Graph Construction from Text · 2018. 2. 5. · Tutorial Outline 1. Knowledge Graph Primer [Jay] 2. Knowledge Extraction from Text a. ... Entity resolution,](https://reader036.fdocuments.in/reader036/viewer/2022071214/6043d985afeeb677752343a6/html5/thumbnails/12.jpg)
DetectingNamedEntities
UsesinKGConstruction:• Mentionsdescribesthenodes• Typesareincrediblyimportant!
• Oftenrestrictrelations• Fine-grainedtypesareinformative!
• Brooklyn:city• Sanders:politician,senator
Howitisdone:• Contextisimportant!
• Georgia,Washington,…• JohnDeere,ThomasCook,…• Princeton,Amazon,…
• Labelwholesentencetogether• Structuredpredictionagain
John was born in Liverpool, to Julia and Alfred Lennon.Person Location Person Person
12
![Page 13: A Tutorial - Knowledge Graph Construction from Text · 2018. 2. 5. · Tutorial Outline 1. Knowledge Graph Primer [Jay] 2. Knowledge Extraction from Text a. ... Entity resolution,](https://reader036.fdocuments.in/reader036/viewer/2022071214/6043d985afeeb677752343a6/html5/thumbnails/13.jpg)
NER:EntityTypes
3class: Location,Person,Organization
4class: Location,Person,Organization,Misc
7class: Location,Person,Organization,Money,Percent,Date,Time
FromStanfordCoreNLP (http://nlp.stanford.edu/software/CRF-NER.shtml)
PERSON People,includingfictional.NORP Nationalitiesorreligiousorpoliticalgroups.FACILITY Buildings,airports,highways,bridges,etc.ORG Companies,agencies,institutions,etc.GPE Countries,cities,states.LOC Non-GPElocations,mountainranges,bodiesof
water.PRODUCT Objects,vehicles,foods,etc.(Notservices.)EVENT Namedhurricanes,battles,wars,sportsevents,etc.WORK_OF_ART Titlesofbooks,songs,etc.LANGUAGE Anynamedlanguage.
StanfordCoreNLP
spaCy.io
13
![Page 14: A Tutorial - Knowledge Graph Construction from Text · 2018. 2. 5. · Tutorial Outline 1. Knowledge Graph Primer [Jay] 2. Knowledge Extraction from Text a. ... Entity resolution,](https://reader036.fdocuments.in/reader036/viewer/2022071214/6043d985afeeb677752343a6/html5/thumbnails/14.jpg)
NER:EntityTypes
•Moreonthislater…
FromLing&Weld.AAAI2012(http://aiweb.cs.washington.edu/ai/pubs/ling-aaai12.pdf)
Fine-grainedTypes
14
![Page 15: A Tutorial - Knowledge Graph Construction from Text · 2018. 2. 5. · Tutorial Outline 1. Knowledge Graph Primer [Jay] 2. Knowledge Extraction from Text a. ... Entity resolution,](https://reader036.fdocuments.in/reader036/viewer/2022071214/6043d985afeeb677752343a6/html5/thumbnails/15.jpg)
DependencyParsing
UsesinKGConstruction:• Incrediblyusefulforrelations!
• Whatverbisattached?• Relationtowhichmention?
• Incrediblyusefulforattributes!• Appositives:“X,theCEO,…”
• Pathsareusedassurfacerelations
Howitisdone:• Model:scoretreesusingfeatures
• Lexical:words,POS,…• Structure:distance,…
• Prediction:Searchovertrees• greedy,spanningtree,belief
propagation,dynamicprog,…
Usinghttp://nlp.stanford.edu:8080/corenlp/process 15
![Page 16: A Tutorial - Knowledge Graph Construction from Text · 2018. 2. 5. · Tutorial Outline 1. Knowledge Graph Primer [Jay] 2. Knowledge Extraction from Text a. ... Entity resolution,](https://reader036.fdocuments.in/reader036/viewer/2022071214/6043d985afeeb677752343a6/html5/thumbnails/16.jpg)
DependencyPaths
John was born in Liverpool, to Julia and Alfred Lennon.
John, Liverpool
John, Julia
John, Alfred Lennon
TextPatterns
“wasbornin”
“wasborninLiverpool,to”
“wasborninLiverpool,toJuliaand”
DependencyPaths
“wasbornin”
“wasbornto”
“wasbornto”
nmod:to
nmod:in
case
case
16
![Page 17: A Tutorial - Knowledge Graph Construction from Text · 2018. 2. 5. · Tutorial Outline 1. Knowledge Graph Primer [Jay] 2. Knowledge Extraction from Text a. ... Entity resolution,](https://reader036.fdocuments.in/reader036/viewer/2022071214/6043d985afeeb677752343a6/html5/thumbnails/17.jpg)
Within-documentCoreference
John was born in Liverpool, to Julia and Alfred Lennon.
Mrs.Lennon....hismother..
hisfather
Alfred
hethePool
UsesinKGConstruction:• Morecontextforeachentity!• Manyrelationsoccuronpronouns
• “Heismarriedtoher”• Coref canbeusedfortypes
• Nominals:Thepresident,…• Difficult,sooftenignored
Howitisdone:• Mo`del:scorepairwiselinks
• deppath,similarity,types,…• “representativemention”
• Prediction:Searchoverclusterings• greedy(lefttoright),ILP,
beliefpropagation,MCMC,…
Lennon..
JohnLennon...
He…
17
![Page 18: A Tutorial - Knowledge Graph Construction from Text · 2018. 2. 5. · Tutorial Outline 1. Knowledge Graph Primer [Jay] 2. Knowledge Extraction from Text a. ... Entity resolution,](https://reader036.fdocuments.in/reader036/viewer/2022071214/6043d985afeeb677752343a6/html5/thumbnails/18.jpg)
InformationExtraction
JohnLennon
AlfredLennon
JuliaLennon
Liverpoolbirthplace
childOf
childOf
spouse
InformationExtraction
NNP VBD VBD IN NNP TO NNP CC NNP NNP
John was born in Liverpool, to Julia and Alfred Lennon.Person Location Person Person
Lennon..JohnLennon...
Mrs.Lennon....hismother..
hisfatherAlfredhe
thePool
18
![Page 19: A Tutorial - Knowledge Graph Construction from Text · 2018. 2. 5. · Tutorial Outline 1. Knowledge Graph Primer [Jay] 2. Knowledge Extraction from Text a. ... Entity resolution,](https://reader036.fdocuments.in/reader036/viewer/2022071214/6043d985afeeb677752343a6/html5/thumbnails/19.jpg)
SurfacePatternsCombinetokens,dependencypaths,andentitytypestodefinerules.
Argument1 Argument2,Person Organization
DT CEO of
appos nmod
casedet
BillGates,theCEOofMicrosoft,said…Mr.Jobs,thebrilliantandcharmingCEOofAppleInc.,said…… announcedbySteveJobs,theCEOofApple.… announcedbyBillGates,thedirectorandCEOofMicrosoft.… musedBill,aformerCEOofMicrosoft.andmanyotherpossibleinstantiations…
19
![Page 20: A Tutorial - Knowledge Graph Construction from Text · 2018. 2. 5. · Tutorial Outline 1. Knowledge Graph Primer [Jay] 2. Knowledge Extraction from Text a. ... Entity resolution,](https://reader036.fdocuments.in/reader036/viewer/2022071214/6043d985afeeb677752343a6/html5/thumbnails/20.jpg)
Rule-BasedExtraction
Highprecision:whenitfires,it’scorrectEasytoexplainpredictionsEasytofixmistakes
Useacollectionofrulesasthesystemitself
However…OnlyworkwhentherulesfirePoorrecall:Donotgeneralize!
Argument1 Argument2,Person Organization
DT CEO of
appos nmod
casedet Implies Argument1 Argument2headOf
Source:• Manuallyspecified• LearnedfromDataMultipleRules:• Attachpriorities/precedence• Attachprobabilities(morelater)
Variations
20
![Page 21: A Tutorial - Knowledge Graph Construction from Text · 2018. 2. 5. · Tutorial Outline 1. Knowledge Graph Primer [Jay] 2. Knowledge Extraction from Text a. ... Entity resolution,](https://reader036.fdocuments.in/reader036/viewer/2022071214/6043d985afeeb677752343a6/html5/thumbnails/21.jpg)
SupervisedExtraction
MachineLearning:hopefully,generalizesthelabelsintherightway
UseallofNLPasfeatures:words,POS,NER,dependencies,embeddings
However
Usually,alotoflabeleddata isneeded,whichisexpensive&timeconsuming.Requiresalotoffeatureengineering!
Classifier
P(birthplace)= 0.75
John was born in Liverpool, to Julia and Alfred Lennon.
FeatureEngineering
…NER DepPath Textinb/w embeddingsPOS
21
![Page 22: A Tutorial - Knowledge Graph Construction from Text · 2018. 2. 5. · Tutorial Outline 1. Knowledge Graph Primer [Jay] 2. Knowledge Extraction from Text a. ... Entity resolution,](https://reader036.fdocuments.in/reader036/viewer/2022071214/6043d985afeeb677752343a6/html5/thumbnails/22.jpg)
EntityResolution&Linking
...during the late 60's and early 70's, Kevin Smith worked with several local...
...the term hip-hop is attributed to Lovebug Starski. What does it actually mean...
The filmmaker Kevin Smith returns to the role of Silent Bob...
Nothing could be more irrelevant to Kevin Smith's audacious ''Dogma'' than ticking off...
Like Back in 2008, the Lions drafted Kevin Smith, even though Smith was badly...
... backfield in the wake of Kevin Smith's knee injury, and the addition of Haynesworth...
... The Physiological Basis of Politics,” by Kevin Smith, Douglas Oxley, Matthew Hibbing...
22
![Page 23: A Tutorial - Knowledge Graph Construction from Text · 2018. 2. 5. · Tutorial Outline 1. Knowledge Graph Primer [Jay] 2. Knowledge Extraction from Text a. ... Entity resolution,](https://reader036.fdocuments.in/reader036/viewer/2022071214/6043d985afeeb677752343a6/html5/thumbnails/23.jpg)
EntityNames:TwoMainProblems
DifferentNamesforEntities
InconsistentReferencesMSFT,APPL,GOOG…
Typos/MisspellingsBaarak,Barak,Barrack,…
NickNamesBamBam,Drumpf,…
EntitieswithSameName
PartialReference
Thingsnamedaftereachother
Firstnamesofpeople,Locationinsteadofteamname,Nicknames
Clinton,Washington,Paris,Amazon,Princeton,Kingston,…
SametypeofentitiessharenamesKevinSmith,JohnSmith,Springfield,…
23
![Page 24: A Tutorial - Knowledge Graph Construction from Text · 2018. 2. 5. · Tutorial Outline 1. Knowledge Graph Primer [Jay] 2. Knowledge Extraction from Text a. ... Entity resolution,](https://reader036.fdocuments.in/reader036/viewer/2022071214/6043d985afeeb677752343a6/html5/thumbnails/24.jpg)
EntityLinkingApproach
24
Washington drops 10 points after game with UCLA Bruins.
CandidateGenerationWashingtonDC,GeorgeWashington,Washingtonstate,LakeWashington,WashingtonHuskies,DenzelWashington,UniversityofWashington,WashingtonHighSchool,…
EntityTypesWashingtonDC,GeorgeWashington,Washingtonstate,LakeWashington,WashingtonHuskies,DenzelWashington,UniversityofWashington,WashingtonHighSchool,…
LOC/ORG
CoreferenceWashingtonDC,GeorgeWashington,Washingtonstate,LakeWashington,WashingtonHuskies,DenzelWashington,UniversityofWashington,WashingtonHighSchool,…
UWashington,Huskies
Coherence UCLABruins,USCTrojans
WashingtonDC,GeorgeWashington,Washingtonstate,LakeWashington,WashingtonHuskies,DenzelWashington,UniversityofWashington,WashingtonHighSchool,…
Vinculum,Ling,Singh,Weld,TACL(2015)
![Page 25: A Tutorial - Knowledge Graph Construction from Text · 2018. 2. 5. · Tutorial Outline 1. Knowledge Graph Primer [Jay] 2. Knowledge Extraction from Text a. ... Entity resolution,](https://reader036.fdocuments.in/reader036/viewer/2022071214/6043d985afeeb677752343a6/html5/thumbnails/25.jpg)
InformationExtraction
JohnLennon
AlfredLennon
JuliaLennon
Liverpoolbirthplace
childOf
childOf
spouse
InformationExtraction
NNP VBD VBD IN NNP TO NNP CC NNP NNP
John was born in Liverpool, to Julia and Alfred Lennon.Person Location Person Person
Lennon..JohnLennon...
Mrs.Lennon....hismother..
hisfatherAlfredhe
thePool
25