ling/c sc/psyc 438/538 -...
TRANSCRIPT
Today'sTopics
• Note:homeworks 12and13graded• OPTIONAL 2nd chancehomework(only ifyoudidbadlyontheProlog)• duenextMonday(bymidnight)
• 538Presentations• ChomskyNormalForm(CNF)revisited• GoogleandMisspellings
OPTIONAL Homework14Englishhasasetofverbsthataretransitivebutobligatorilytakeareflexivesobject,asin:
Johnperjuredhimself*JohnperjuredShevindicatedherself*ShevindicatedTheyingratiatedthemselves*TheyingratiatedYousunnedyourself*YousunnedIhelpedmyself*Ihelped
Theintransitivecounterpartsareconsideredungrammatical(*).Levin(1993)callssuchverbsObligatorilyReflexiveObject verbs.(Note:somemaytakenon-reflexiveobjectsbutwillhaveadifferentmeaning.)
• Question1:createatablesRo(S,RO) (S=subject,RO=reflexiveobject)thatliststhesubjectandreflexiveobjectsintheabovesentences:sRo(john, himself).sRo(she,herself).
• Question2:writeanaturallanguagegrammarusingProloggrammarrulestohandletheabovesentences.
• YourgrammarshouldreturnPrologtermsrepresentingtheparse.UsethePTBtagset andsyntactictags.Yourgrammarshouldbecapableofdealingwithexampleslikethefollowing.
Examples:JohnperjuredhimselfJohnperjured*Johnperjuredthemselves
Submityourgrammarandplentyofexamples,e.g.s(Parse,[john,perjured,himself],[]).Parse = s(np(nnp(john)),vp(vbd(perjured),np(prp(himself))))
538Presentations
• Assignments:Name Topic DateAndrewZupon 20.7WordSimilarity:DistributionalMethods 30-Nov
MariaAlexeeva24.1-2PropertiesofHumanConversation+BasicDialogueSystems 30-Nov
JiahengXie 22.1NamedEntityRecognition 5-Dec
BrendanMurphy 25.5-6AlignmentinMT+TrainingAlignmentModels 5-DecMohammadrezaEbrahimi 22.3TemporalandEventProcessing 5-DecRoyaKabiri 19.1-4WordSenses->EventParticipants 30-NovRebeccaCordes 17.3-4FirstOrderLogic 5-Dec
SeongjinPark17.1-2ComputationalDesiderataforRepresentation+Model-TheoreticSemantics 30-Nov
JohnCulnan 23.3-4SummarizationandMulti-textsummarization 30-NovRianneLyons 24.7Plan-BasedDialogAgents 5-DecChenChen 18.1-3ComputationalSemantics 30-NovYiyunZhao 20.1-5WordSenseDisambiguation 5-DecRaghebAl-Ghezi 21.7-8CoferenceResolutionandEvaluation 5-Dec
ChomskyNormalForm(CNF)
• Conversionsteps:1. newstartsymbols0 --> s.
(s originalstartsymbol)tocopewithpossibleemptyderivation.s0 istheonlynonterminalallowedtohaveforms0 --> s
1. x --> … [w] ... (|RHS|>1)transforminto: x --> ... xw ... andxw --> [w].(xw anewnonterminal)
3. x --> y1, ...,yn. (|RHS|>2)transformintoacascadingsequenceofbinarybranchingrules:x --> y1, x1. x1 --> y2, x2. ... xn-1 --> yn-1, yn.
4. foreachinstanceofx --> []. andy --> ... x ...addacopywithoutx,i.e. y --> ......thendeletex --> [].
5. removex --> y. (exception:x cannotbes0)Replacex byy inotherrules.
ChomskyNormalForm(CNF)
• Example:1. s --> [].2. s --> a.3. a --> a, b, b, a.4. a --> [a].5. b --> [b], c, [b].6. c --> [c].
1. [] 2. [a] 3. [a, b, c, b, b, c, b, a] 4. [a, b, c, b, b, c, b, a, b, c, b, b, c, b, a] 5. [a, b, c, b, b, c, b, a, b, c, b, b, c, b, a, b, c, b, b, c, b, a]6. …
• Let'sconvertthisgrammartoCNF.
ChomskyNormalForm(CNF)
• Example:1. s --> [].2. s --> a.3. a --> a, b, b, a.4. a --> [a].5. b --> [b], c, [b].6. c --> [c].
1. s0 --> s.2. s --> [].3. s --> a.4. a --> a, bba.5. bba --> b, ba.6. ba --> b, a.7. a --> [a].8. b --> b2, cb.9. b2 --> [b].10. cb --> c, b2.11. c --> [c].
1. s0 --> [].2. s0 --> a.3. a --> a, bba.4. bba --> b, ba.5. ba --> b, a.6. a --> [a].7. b --> b2, cb.8. b2 --> [b].9. cb --> c, b2.10. c --> [c].
10
MinimumEditDistance
• generalstringcomparison
• editoperationsareinsertion,deletionandsubstitution
• notjustlimitedtodistancedefinedbyasingleoperationaway
• wecanaskhowdifferentisstringa fromb bytheminimumeditdistance
11
MinimumEditDistance
• applications• couldbeusedformulti-typocorrection• usedinMachineTranslationEvaluation(MTEval)• example
• Source:⽣産⼯程改善について• Translations:• (Standard)Forimprovementoftheproductionprocess• (MT-A)Aboutaproductionprocessbetterment• (MT-B)Abouttheproductionprocessimprovement• method
• computeeditdistancebetweenMT-AandStandardandMT-BandStandardintermsofwordinsertion/substitutionetc.
12
MinimumEditDistance
• costmodels• Levenshtein
• insertion,deletionandsubstitutionallhaveunitcost
• Levenshtein (alternate)• insertion,deletionhaveunitcost• substitutionistwiceasexpensive• substitution=oneinsertfollowedbyone
delete
• Typewriter• insertion,deletionandsubstitutionall
haveunitcost• modifiedbykeyproximity
MinimumEditDistance
• DynamicProgramming• divide-and-conquer
• tosolveaproblemwedivideitintosub-problems• sub-problemsmayberepeated
• don’twanttore-solveasub-problemthe2ndtimearound• idea:putsolutionstosub-problemsinatable
• andjustlookupthesolution2ndtimearound,therebysavingtime• memoization
we’lluseanExcelspreadsheet…
MinimumEditDistance• Considerasimplecase:xy ⇄ yx
• Minimum#ofoperations:• insertanddelete• cost=2
• Minimum#ofoperations:• swap• cost=?
MinimumEditDistanceComputation
• OrinMicrosoftExcel,file:eds.xls (oncoursewebpage)
$inacellreferencemeansdon’tchangewhencopiedfromcelltocelle.g.inC$11staysthesamein$A3Astaysthesame
MinimumEditDistance
• Task:transformstrings1..si intostringt1..tj• each sn and tn are letters• string s is of length i, t is of length j
• Example:• s=leader,t=adapter• i =6,j=7• Let’ssayyou’reallowedjustthreeoperations:(1)deletealetter,(2)insertaletter,or(3)substitutealetterforanotherletter• Whatisonepossiblewaytogeneratet froms?
MinimumEditDistance
• Example:• s=leader,t=adapter• Whatisonepossiblewaytogeneratet froms?• leader
• adapter• costis2deletesand3inserts,total5operations• Question:isthistheminimumpossible?
leader◄leade◄lead◄lea◄le◄l◄◄a◄ad◄ada◄adap◄adapt◄adapte◄adapter◄
Simplestmethodcost:13operations
MinimumEditDistance0 1 2 3 4 5 6 7
a d a p t e r0
1 l2 e3 a4 d5 e6 r
cell(2,3)costof
transformingleintoada
MinimumEditDistance0 1 2 3 4 5 6 7
a d a p t e r0
1 l2 e3 a4 d5 e6 r
cell(2,3)costof
transformingleintoada
cell(6,7)costof
transformingleader intoadapter
MinimumEditDistance0 1 2 3 4 5 6 7
a d a p t e r0
1 l2 e3 a4 d5 e6 r
cell(3,0)costof
transformingleainto(empty)
MinimumEditDistance0 1 2 3 4 5 6 7
a d a p t e r0
1 l2 e3 a4 d5 e6 r
cell(0,4)costof
transforming(empty)intoadap
MinimumEditDistance0 1 2 3 4 5 6 7
a d a p t e r0
1 l2 e3 a4 d5 e k
6 r
cell(5,6)costof
transformingleadeintoadapte
MinimumEditDistance0 1 2 3 4 5 6 7
a d a p t e r0
1 l2 e3 a4 d5 e k
6 r
cell(5,6)costof
transformingleadeintoadapte
MinimumEditDistance0 1 2 3 4 5 6 7
a d a p t e r0
1 l2 e3 a4 d5 e k
6 r k
cell(5,6)costof
transformingleadeintoadapte
MinimumEditDistance0 1 2 3 4 5 6 7
a d a p t e r0
1 l2 e k
3 a4 d5 e6 r
cell(2,3)costof
transformingleintoada
MinimumEditDistance0 1 2 3 4 5 6 7
a d a p t e r0
1 l2 e k
3 a4 d5 e6 r
cell(2,3)costof
transformingleintoada
cell(2,4)costof
transformingleintoadap
➡
MinimumEditDistance0 1 2 3 4 5 6 7
a d a p t e r0
1 l2 e k k+1
3 a4 d5 e6 r
cell(2,3)costof
transformingleintoada
cell(2,4)costof
transformingleintoadap
➡
l e
a d a p
MinimumEditDistance0 1 2 3 4 5 6 7
a d a p t e r0
1 l k
2 e3 a4 d5 e6 r
cell(1,4)costof
transforminglintoadap
➡
MinimumEditDistance0 1 2 3 4 5 6 7
a d a p t e r0
1 l k
2 e k+1
3 a4 d5 e6 r
cell(1,4)costof
transforminglintoadap
➡
l e
a d a p
MinimumEditDistance0 1 2 3 4 5 6 7
a d a p t e r0
1 l k
2 e3 a4 d5 e6 r
cell(1,3)costof
transforminglintoada
MinimumEditDistance0 1 2 3 4 5 6 7
a d a p t e r0
1 l k
2 e k+2
3 a4 d5 e6 r
cell(1,3)costof
transforminglintoada
assumingthecostofswappinge forp
is2
l e
a d a p
MinimumEditDistance0 1 2 3 4 5 6 7
a d a p t e r0
1 l k1,3 k1,4
2 e k2,3 ?
3 a4 d5 e6 r
➡
➡
cell(2,4)minimumofthethreecoststogethereinonestep
MinimumEditDistance0 1 2 3 4 5 6 7
a d a p t e r0
1 l2 e3 a4 d5 e6 r
cell(3,0)costof
transformingleainto(empty)
MinimumEditDistance0 1 2 3 4 5 6 7
a d a p t e r0 0
1 l 1
2 e 2
3 a4 d5 e6 r
➡ costofle à=costofl à ,plusthecostofdeletingthee
MinimumEditDistance0 1 2 3 4 5 6 7
a d a p t e r0 0 1 2 3 4 5 6 7
1 l 1
2 e 2
3 a 3
4 d 4
5 e 5
6 r 6
MinimumEditDistance0 1 2 3 4 5 6 7
a d a p t e r0 0 1 2 3 4 5 6 7
1 l 1
2 e 2
3 a 3
4 d 4
5 e 5
6 r 6
MinimumEditDistance0 1 2 3 4 5 6 7
a d a p t e r0 0 1 2 3 4 5 6 7
1 l 1
2 e 2
3 a 3
4 d 4
5 e 5
6 r 6
➡
➡
MinimumEditDistance0 1 2 3 4 5 6 7
a d a p t e r0 0 1 2 3 4 5 6 7
1 l 1 2
2 e 2
3 a 3
4 d 4
5 e 5
6 r 6
➡
➡
MinimumEditDistance0 1 2 3 4 5 6 7
a d a p t e r0 0 1 2 3 4 5 6 7
1 l 1
2 e 2
3 a 3
4 d 4 5 6
5 e 5 6
6 r 6
MinimumEditDistance0 1 2 3 4 5 6 7
a d a p t e r0 0 1 2 3 4 5 6 7
1 l 1
2 e 2
3 a 3
4 d 4 5 6
5 e 5 6
6 r 6
MinimumEditDistance0 1 2 3 4 5 6 7
a d a p t e r0 0 1 2 3 4 5 6 7
1 l 1
2 e 2
3 a 3
4 d 4 5 6
5 e 5 6 5
6 r 6
MinimumEditDistance0 1 2 3 4 5 6 7
a d a p t e r0 0 1 2 3 4 5 6 7
1 l 1
2 e 2 6 7
3 a 3 5
4 d 4
5 e 5
6 r 6
MinimumEditDistance0 1 2 3 4 5 6 7
a d a p t e r0 0 1 2 3 4 5 6 7
1 l 1
2 e 2 6 7
3 a 3 5
4 d 4
5 e 5
6 r 6
➡
MinimumEditDistance0 1 2 3 4 5 6 7
a d a p t e r0 0 1 2 3 4 5 6 7
1 l 1
2 e 2 6 7
3 a 3 5 6
4 d 4
5 e 5
6 r 6
➡
MinimumEditDistance0 1 2 3 4 5 6 7
a d a p t e r0 0 1 2 3 4 5 6 7
1 l 1
2 e 2
3 a 3
4 d 4
5 e 5 6 5
6 r 6 7
MinimumEditDistance0 1 2 3 4 5 6 7
a d a p t e r0 0 1 2 3 4 5 6 7
1 l 1
2 e 2
3 a 3
4 d 4
5 e 5 6 5
6 r 6 7
➡
MinimumEditDistance0 1 2 3 4 5 6 7
a d a p t e r0 0 1 2 3 4 5 6 7
1 l 1
2 e 2
3 a 3
4 d 4
5 e 5 6 5
6 r 6 7 6
➡