SemanticParsing
Announcements• PlantoreleasemidtermgradesbyThursday• Onedaybehindonsyllabus.Willlikelydropimagecap:oning.
Whatissemanticparsing?• Mappingtoameaningrepresenta:on• Seman:crepresenta:onwithdesiderata• Seman:croles• Composi:onality• Truthpreserving
• Applica:onrepresenta:on
TwoExamples• ParsingintoAbstractMeaningRepresenta:on(AMR)• LanguagetoCode:learningparsersforif-this-then-thatrecipes• Simplerulesthatallowuserstocontrolaspectsoftheirdigitallivesincludingsmartphones• LargeonlinenaturallyoccurringrepositoryofNLdescrip:onsandassociatedcode
TwoExamples• ParsingintoAbstractMeaningRepresenta2on• LanguagetoCode:learningparsersforif-this-then-thatrecipes• Simplerulesthatallowuserstocontrolaspectsoftheirdigitallivesincludingsmartphones• LargeonlinenaturallyoccurringrepositoryofNLdescrip:onsandassociatedcode
AMRcharacteristics• Rooted,labeledgraphs• Abstractawayfromsyntac:cdifferences• Hedescribedherasagenius• Hisdescrip:onofher:genius• Shewasageniusaccordingtohisdescrip:on• UsePropbankframesets• “bondinvestor”:invest-01• HeavilybiasedtowardsEnglish
• Variables(ornodes)foren::es,events,proper:es,states• Leafnodesarelabeledwithconcepts:• (b/boy)aninstanceoftheconceptboy
• Rela:onslinken::es• (d/die-01:loca:on(p/park)):therewasadeathinthepark
• AMRconcepts• Englishwords(e.g.,boy),Propbankframesets(e.g.,want-01)orspecialkeywords(en:ty-types,quan::esorconjunc:ons)
AMRrelations• ~100rela:ons• Framearguments• Arg0,arg1,arg2,arg3,arg4,arg5(Propbank)
• Generalseman:crela:ons• :Accompanier,:age,:beneficiary,:cause,:compared-to,:concession,:condi:on,:consistof,:degree,:des:na:on,:direc:on,:domain,:dura:on,:employed-by,:example,:extent,:frequency,:instrument,:li,:loca:on,:manner,:medium,:mod,:mode,:name,:part,:path,:polarity,:poss,:purpose,:source,:subevent,:subset,::me,:topic,:value.
• Rela:onsforquan:ty• :quant,:unit,:scale
• Rela:onsfordateen:ty• :day,:month,:year,:weekday,::me,::mezone,:quarter,:dayperiod,:season,:year2,:decade,:century,:calendar,:era.
• Rela:onsforlists• :op1,:op2,….:op10
• Plusinverses(e.g.,:arg0-of,:loca:on-of)
Framesets• ExamplesofusingFramesetstoextractawayfromEnglishsyntax• (d/describe-01• :arg0(m/man)• :arg1(m2/mission)• :arg2(d/disaster))
• :arg0thedescriber,:arg1thethingdescribed,:arg2whatitisdescribing• Themandescribedthemissionasadisaster.Asthemandescribedit,themissionwasadisaster
Generalsemanticrelations• Non-corerela:ons• (s:hum-02• :arg0(s2/soldier)• :beneficiary(g/girl)• ::me(w/walk-01
• :arg0g• :des:na:on(t/town)))
• Thesoldierhummedtothegirlasshewalkedtotown.
Co-reference• AMRabstractsawayfromsurfaceformsforco-referencesuchaspronouns,zero-pronouns,reflexive,controlstructure.Instead,variablesarere-used.• See“g”inpreviousexample.
Inverserelations• Inordertoobtainrootedstructures• (s/sing-01• :arg0(b/boy
:source(c/college))
• Theboyfromthecollegesang.
• (b/boy• :arg0-of(s/sing-01):source(c/college))thecollegeboywhosang
ModalsandNegation• Nega:onisrepresentedwith:polarityandmodalityisrepresentedwithconcepts• (g/go-01
:arg0(b/boy):polarity-)
Theboydidnotgo.
• (p/possible:domain(g/go-01 :arg0(b/boy)):polarity-))
Theboycannotgo.It’snotpossiblefortheboytogo.
• (p/obligate-01:arg0(g/go-01 :arg0(b/boy)):polarity-)
• Theboydoesn’thavetogo.• Theboyisnotobligatedtogo.
Questions• Amr-unknowntoindicatewh-ques:ons• (f/find-01
:arg0(g/girl):arg1(a/amr-unknown))
Whatdidthegirlfind?
• (f/find-01):arg0(g/girl):arg1(b/boy):loca:on(a/amr-unknown))
Wheredidthegirlfindtheboy?
• (f/find-01arg0(g/girl)arg1(t/toy :poss(a/amr-unknown))
Sentence??
Verbs• CorrespondtoPropbankframesets(l/look-05
arg0:(b/boy)arg1:(a/answer)
Theboylookeduptheanswer.Theboylookedtheanswerup.
Nouns• PropBankverbframesetsrepresentmanynounsaswell(d/destroy-01
arg0:(b/boy)arg1:(r/room)
thedestruc:onoftheroombytheboytheboy’sdestruc:onoftheroomtheboydestroyedtheroom
• Nominaliza:onisarole(s/see-01)
arg0:(j/judge)arg1:(e/explode-01))
Thejudgesawtheexplosion
• Howabout?(r/read-01
:arg0(j/judge):arg1(t/thing :arg1-of(p/propose-01))
Sentence?
Adjectives• Canalsouseframesets(s/spy
:arg0-of(a/afract-01))theafrac:vespy
• (s/spy:arg0-of(a/afract-01 :arg1(w/woman)))
NP?
Compositionality• Themeaningofthewholeisequaltothesumofthemeaningofitsparts
• HowisAMRcomposi:onal?(d/describe-01• :arg0(m/man):arg1(m2/mission):arg2(d/disaster))
• (s/spy:arg0-of(a/afract-01))
• WhatistheAMRfortheafrac:vespydescribedthemissionasadisaster?
AMRdata• Availabledownloads:hfps://amr.isi.edu/download.html• LiflePrinceavailabletoall• EnglishandChinese
• Biomedicaldata• Generic,wide-rangingcontent:LDC
• ReferencesonAMRdata• Abstractmeaningrepresenta:onforsembanking:hfps://amr.isi.edu/a.pdf• GuidelinesforAMRannota:on:amr.isi.edu/language.html
AMRparsing• Manyapproaches• E.g.,CCG,intologicalform,graphparsing,syntax-basedmachinetransla:on,hyperedgereplacementgrammars
• SemEval2016:Track8onAMRparsinghfp://alt.qcri.org/semeval2016/task8/• Today:AParserforAbstractMeaningRepresenta:onUsingLearningtoSearch
LearningtoSearch(L2S)• Familyofapproachesthatsolvesstructuredpredic:onproblems• Decomposestheproduc:onofthestructuredoutputintermsofexplicitsearchspace• Learnshypothesesthatcontrolapolicythattakesac:onsinthesearchspace
• AMRisastructuredseman:crepresenta:on
• Modellearningofconceptsandrela:onsinaunifiedsejng.
AMRparsingtaskdecomposed• Predic:ngconcepts• Predic:ngtheroot• Predic:ngrela:onsbetweenpredicatedconcepts
Searchspace• States={x1,x2,....,xn,y1,y2,….,yi-1}wheretheinput{x1,x2,....,xn}arethenwordsofthesentence• Conceptpredic:on:labelsy1,y2,….,yi-1aretheconceptspredicteduptoi-1.• Nextac:on:yiistheconceptforwordxifromak-bestlistofconcepts
• Rela:onpredic:on:labelsarerela:onsforpredictedpairsofconcepts• Rootpredic:on:mul:-taskclassifierselectsrootconceptfromallpredictedconcepts
Example
Selectingk-bestlists• Conceptcandidates• Thesetofallconceptsassignedtosiintheen:retrainingdata• Ifsiunseen->lemma:zedspan,Propbankframes,andnull
• Rela:oncandidates(fromcitocj)• Unionof• Pairwisei,j:Alldirectedrela:onsfromcitocjwhentheyoccurredinthesameAMR
• Outgoingi:Alloutgoingrela:onsfromci• Incomingj:Allincomingrela:onsintocj
• Whenunseenintrainingdata,allrela:onsinthetrainingdata.
Whatdoesthislooklike?
Pre-processingfortraining• Wheredospanscomefrom?• JAMRalignertoalignsentenceswithAMRconceptsandrela:onsintrainingdata• Singlewordtosingleconcept• Spanofwordstographfragment:“StoriesfromNature”alignedtographrootedat“name”• Nameden::es• Mul:wordexpressions
• Wordalignedtonull• Func:onwords(e.g.,“to”,“a”,“the”)
Singleconceptormultiple?• BarackObama• Atthedropofahat(e.g.,Iwoulddoanythingforyouatthedropofahat).• ThePresidentoftheUnitedStates
AlignmentDetails• Forcedalignments• Someconceptsarenotalignedtowords• Forcealignmentsbasedoncount(unalignedconceptalignedtounalignedwords)acrosstrainingcorpus
• Test:me• Eachwordasinglespanexcept• Nameden::es• Dateand:memul:-wordexpressionsusingregularexpressions
Learning• Ateachstate,learnmul:pleclassifiers• Oneconcept(rela:on)againstallothers
• Predicttheconcept,rela:on,rootsequencefortheen:resentence• UseHammingdistancetocomputetheloss• Adjustpredic:onbasedonloss->jointlearning
FeaturesforLearningConcepts• Wordsinsiandcontext• POSofwordsinsiandcontext• Nameden:tytagsforwordsinsi• Binaryfeatureindica:ngwhetherwordsinsiarestopwords• Alldependencyedgesemana:ngfromwordsinsi• Binaryfeatureindica:ngwhethercistheconceptmostfrequentlyalignedwithsi• Predictedconceptsforthetwopreviousspans• Conceptlabelanditsconjunc:onwithallpreviousfeatures• IfthelabelisaFramesetfeature,thentheframeanditssense
Whatdoesthislooklike?
FeaturesforLearningRelations• Givencicjandr• Thetwoconcepts(cicj)andtheirconjunc:on• Wordsinthecorrespondingspansandtheirconjunc:ons• POStagsofwordsinspansandtheirconjunc:ons• Alldependencyedgeswithtailinwiandheadinwj• BinaryfeaturewhichistrueiffI<j• Rela:onlabelanditsconjunc:onwithallotherlabels
FeaturesforLearningRoot• Conceptlabel.IftheconceptisaFrameset,thentheframeanditssense• Wordsinthespancorrespondingtoconcept• POStagsofwordsinthespan• Binaryfeatureindica:ngwhetheroneofthewordsinthespanistherootofthedependencytree
SomeOddsandEnds• Connec:vity:• Foreachdisconnectedcomponent,finditsroot• Thenconnectroottorootofsentence
• Cycles• Nospecificconstraintsagainstcyclesinlearning• Inprac:ce,only5%ofpredictedAMRgraphshavecycles
Results• Useatool(Smatch)tocomparepredictedAMRwithgoldAMR• F1=.46• P=.51• R=.43• Meanofallsystemsinsharedtask:F1=.55,standarddevia:on.06
TwoExamples• ParsingintoAbstractMeaningRepresenta:on(AMR)• LanguagetoCode:learningparsersforif-this-then-thatrecipes• Simplerulesthatallowuserstocontrolaspectsoftheirdigitallivesincludingsmartphones• LargeonlinenaturallyoccurringrepositoryofNLdescrip:onsandassociatedcode
TaskerandIFFT• Simpleprogramswithtriggersandac:ons• PhillipsHuelightbulbstoflashredandbluewhentheCubshitahomerun.Homeautoma:onsensorsandcontrollers• Mo:ondetectors• Thermostats• Loca:onsensors• Garagedooropeners
• Usersdescribetherecipesinnaturallanguageandpublishthem
Goal• Tobuildseman:cparsersthatmapfromNLdescrip:ontotheprogramautoma:cally• Collected114,408recipe-NLpairsfromthehfp://irf.comwebsite
ExampleRecipes• TurnonmylightswhenIarrivehome• Textmeifthedooropnes• Addreceiptemailstoaspreadsheet• RemindmetodrinkwaterifI’vebeenatabarformorethan2hours.
MTapproach• Createdacontextfreegrammarforprograms• GrammarforNLrecipes• Learntomapfromonetotheother• Useseparateclassifiersforeachpossibleac:on
• Isitbe7ertoparseintoAMRordirectlyintothecommandlanguage?• WhatareprosforusingAMR?• WhatareconsforusingAMR?