KnowledgeGraph Construction fromText AAAI2017 J AY P UJARA ,S AMEER S INGH ,B HAVANA D ALVI TutorialOverview Part1:KnowledgeGraphs Part2: Knowledge Extraction Part3: Graph Construction Part4:CriticalAnalysis 2 TutorialOutline 1. KnowledgeGraphPrimer [Jay] 2. KnowledgeExtractionfromText a. b. NLPFundamentals InformationExtraction [Sameer] [Bhavana] CoffeeBreak 3. KnowledgeGraphConstruction a. b. ProbabilisticModels EmbeddingTechniques [Jay] [Sameer] 4. CriticalOverviewandConclusion [Bhavana] 3 WhatisKnowledgeExtraction? Text John was born in Liverpool, to Julia and Alfred Lennon. LiteralFacts Alfred Lennon childOf Liverpool birthplace John Lennon childOf Julia Lennon 4 NLP Fundamentals EXTRACTINGSTRUCTURESFROMLANGUAGE WhatisNLP? NLP Unstructured Ambiguous Lotsandlotsofit! Humanscanreadthem,but … veryslowly … can’trememberall … can’tanswerquestions “Knowledge” Structured Precise,Actionable Specifictothetask Canbeusedfordownstream applications,suchascreating KnowledgeGraphs! 6 WhatisNLP? John was born in Liverpool, to Julia and Alfred Lennon. NaturalLanguage Processing Lennon.. JohnLennon... thePool Person Location Mrs.Lennon.. ..hismother.. Person hisfather he Alfred Person John was born in Liverpool, to Julia and Alfred Lennon. NNP VBD VBD IN NNP TO NNP CC NNP NNP 7 WhatisInformationExtraction? Lennon.. JohnLennon... thePool Person Location Mrs.Lennon.. ..hismother.. Person hisfather he Alfred Person John was born in Liverpool, to Julia and Alfred Lennon. NNP VBD VBD IN NNP TO NNP CC NNP NNP InformationExtraction Alfred Lennon childOf Liverpool birthplace John Lennon spouse childOf Julia Lennon 8 Document Entityresolution, Entitylinking, Relationextraction… Coreference Resolution... Sentence Information Extraction BreakingitDown DependencyParsing, Partofspeechtagging, Namedentityrecognition… Alfred Lennon childOf Liverpool birthplace spouse John Lennon childOf Lennon.. JohnLennon... Person thePool Location Julia Lennon Mrs.Lennon.. ..hismother.. Person hisfather he Alfred Person 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. 9 Tokenization&SentenceSplitting “Mr.BobDobolina isthinkin'ofamasterplan. Whydoesn'thequit?” [Mr.][Bob][Dobolina][is][thinkin’][of][a][master][plan][.] [Why][doesn't][he][quit][?] Howitisdone: • Regularexpressions,butnottrivial • Mr.,Yahoo!,lower-case • Fornon-English,incrediblydifficult! • Chinese:no“space”character • Non-trivialforsomedomains… • Whatisa“token”inBioNLP? UsesinKGConstruction: • StrictlyconstrainsotherNLPtasks • PartsofSpeech • DependencyParsing • DirectlyeffectsKGnodes/edges • Mentionboundaries • Relationswithinsentences 10 TaggingthePartsofSpeech NNP VBD VBD IN NNP TO NNP CC NNP NNP John was born in Liverpool, to Julia and Alfred Lennon. Howitisdone: • Contextisimportant! • run,table, bar,… • Labelwholesentencetogether • “Structuredprediction” • ConditionalRandomFields,.. • Now:CNNs,LSTMs,… UsesinKGConstruction: • Entitiesappearasnouns • Verbsareveryuseful • Foridentifyingrelations • Foridentifyingentitytypes • ImportantfordownstreamNLP • NER,DependencyParsing,… 11 DetectingNamedEntities Person Location Person Person John was born in Liverpool, to Julia and Alfred Lennon. Howitisdone: • Contextisimportant! • Georgia,Washington,… • JohnDeere,ThomasCook,… • Princeton,Amazon,… • Labelwholesentencetogether • Structuredpredictionagain UsesinKGConstruction: • Mentionsdescribesthenodes • Typesareincrediblyimportant! • Oftenrestrictrelations • Fine-grainedtypesareinformative! • Brooklyn:city • Sanders:politician,senator 12 NER:EntityTypes StanfordCoreNLP spaCy.io 3class: Location,Person,Organization 4class: Location,Person,Organization,Misc 7class: Location,Person,Organization,Money,Percent,Date,Time 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. FromStanfordCoreNLP (http://nlp.stanford.edu/software/CRF-NER.shtml) 13 NER:EntityTypes Fine-grainedTypes • Moreonthislater… FromLing&Weld.AAAI2012(http://aiweb.cs.washington.edu/ai/pubs/ling-aaai12.pdf) 14 DependencyParsing Howitisdone: • Model:scoretreesusingfeatures • Lexical:words,POS,… • Structure:distance,… • Prediction:Searchovertrees • greedy,spanningtree,belief propagation,dynamicprog,… Usinghttp://nlp.stanford.edu:8080/corenlp/process UsesinKGConstruction: • Incrediblyusefulforrelations! • Whatverbisattached? • Relationtowhichmention? • Incrediblyusefulforattributes! • Appositives:“X,theCEO,…” • Pathsareusedassurfacerelations 15 DependencyPaths nmod:to nmod:in John was born in Liverpool, to Julia and Alfred Lennon. case case TextPatterns John, Liverpool John, Julia John, Alfred Lennon “wasbornin” “wasborninLiverpool,to” “wasborninLiverpool,toJuliaand” DependencyPaths “wasbornin” “wasbornto” “wasbornto” 16 Within-documentCoreference Mrs.Lennon.. He… Lennon.. thePool ..hismother.. JohnLennon... Alfred hisfather he John was born in Liverpool, to Julia and Alfred Lennon. Howitisdone: • Mo`del:scorepairwiselinks • deppath,similarity,types,… • “representativemention” • Prediction:Searchoverclusterings • greedy(lefttoright),ILP, beliefpropagation,MCMC,… UsesinKGConstruction: • Morecontextforeachentity! • Manyrelationsoccuronpronouns • “Heismarriedtoher” • Coref canbeusedfortypes • Nominals:Thepresident,… • Difficult,sooftenignored 17 InformationExtraction Lennon.. JohnLennon... thePool Person Location Mrs.Lennon.. ..hismother.. Person hisfather he Alfred Person John was born in Liverpool, to Julia and Alfred Lennon. NNP VBD VBD IN NNP TO NNP CC NNP NNP InformationExtraction Alfred Lennon childOf Liverpool birthplace John Lennon spouse childOf Julia Lennon 18 SurfacePatterns Combinetokens,dependencypaths,andentitytypestodefinerules. appos nmod case det Argument1 Person , DT CEO of Argument2 Organization BillGates,theCEOofMicrosoft,said… Mr.Jobs,thebrilliantandcharmingCEOofAppleInc.,said… … announcedbySteveJobs,theCEOofApple. … announcedbyBillGates,thedirectorandCEOofMicrosoft. … musedBill,aformerCEOofMicrosoft. andmanyotherpossibleinstantiations… 19 Rule-BasedExtraction appos nmod case det Argument1 Person , DT CEO of Implies Argument1 headOf Argument2 Argument2 Organization Variations Source: • Manuallyspecified • LearnedfromData MultipleRules: • Attachpriorities/precedence • Attachprobabilities(morelater) Useacollectionofrulesasthesystemitself Highprecision:whenitfires,it’scorrect Easytoexplainpredictions Easytofixmistakes However… Onlyworkwhentherulesfire Poorrecall:Donotgeneralize! 20 SupervisedExtraction MachineLearning:hopefully, generalizesthelabelsintherightway UseallofNLPasfeatures:words, POS,NER,dependencies,embeddings P(birthplace)= 0.75 Classifier POS NER DepPath Textinb/w embeddings However Usually,alotoflabeleddata isneeded, whichisexpensive&timeconsuming. Requiresalotoffeatureengineering! … FeatureEngineering John was born in Liverpool, to Julia and Alfred Lennon. 21 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... 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 filmmaker Kevin Smith returns to the role of Silent Bob... Nothing could be more irrelevant to Kevin Smith's audacious ''Dogma'' than ticking off... ... The Physiological Basis of Politics,” by Kevin Smith, Douglas Oxley, Matthew Hibbing... 22 EntityNames:TwoMainProblems EntitieswithSameName Sametypeofentitiessharenames KevinSmith,JohnSmith, Springfield,… Thingsnamedaftereachother Clinton,Washington,Paris, Amazon,Princeton,Kingston,… PartialReference Firstnamesofpeople,Location insteadofteamname,Nicknames DifferentNamesforEntities NickNames BamBam,Drumpf,… Typos/Misspellings Baarak,Barak,Barrack,… InconsistentReferences MSFT,APPL,GOOG… 23 EntityLinkingApproach Washington drops 10 points after game with UCLA Bruins. CandidateGeneration WashingtonDC,GeorgeWashington,Washingtonstate, LakeWashington,WashingtonHuskies,DenzelWashington, UniversityofWashington,WashingtonHighSchool,… WashingtonDC,GeorgeWashington,Washingtonstate, LakeWashington,WashingtonHuskies,DenzelWashington, UniversityofWashington,WashingtonHighSchool,… EntityTypes LOC/ORG Coreference WashingtonDC,GeorgeWashington,Washingtonstate, UWashington, LakeWashington,WashingtonHuskies,DenzelWashington, Huskies UniversityofWashington,WashingtonHighSchool,… Coherence UCLABruins, USCTrojans Vinculum,Ling,Singh,Weld,TACL(2015) WashingtonDC,GeorgeWashington,Washingtonstate, LakeWashington,WashingtonHuskies,DenzelWashington, UniversityofWashington,WashingtonHighSchool,… 24 InformationExtraction Lennon.. JohnLennon... thePool Person Location Mrs.Lennon.. ..hismother.. Person hisfather he Alfred Person John was born in Liverpool, to Julia and Alfred Lennon. NNP VBD VBD IN NNP TO NNP CC NNP NNP InformationExtraction Alfred Lennon childOf Liverpool birthplace John Lennon spouse childOf Julia Lennon 25
© Copyright 2026 Paperzz