1 / 57

Syntactic analysis using Context Free Grammars

Syntactic analysis using Context Free Grammars. Analysis of language. Morphological analysis Chairs <chair, n, plural>, <chair, v, 3 rd person, present> Part Of Speech (POS) tagging The/DT man/NN left/VBD the/DT room/NN

caroun
Télécharger la présentation

Syntactic analysis using Context Free Grammars

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Syntactic analysis using Context Free Grammars

  2. Analysis of language • Morphological analysis • Chairs <chair, n, plural>, <chair, v, 3rd person, present> • Part Of Speech (POS) tagging • The/DT man/NN left/VBD the/DT room/NN • The/DT red/ADJ block/NN on/PREP the/DT blue/ADJ cylinder/NN was/AUX moved/VBD onto/PREP the/DT brown/ADJ table/NN • Any further analysis?

  3. Analysis of language • Part Of Speech (POS) tagging • The/DT man/NN left/VBD the/DT room/NN • The/DT red/ADJ block/NN on/PREP the/DT blue/ADJ cylinder/NN was/AUX moved/VBD onto/PREP the/DT brown/ADJ table/NN • Any further analysis? • chunks, clauses, syntax, semantics, word senses etc… • Today’s lecture on analyzing syntax

  4. What is Syntax? • Study of structure of language • how words can connect to each other • Specifically, goal is to relate surface form (i.e. the sentence) to semantics (the meaning) • Representational device is tree structure

  5. Structure in StringsProposal 1 • Some words: the a small nice big very boy girl sees likes • Some good sentences: • (the) boy (likes a girl) • (the small) girl (likes the big girl) • (a very small nice) boy (sees a very nice boy) • Some bad sentences: • *(the) boy (the girl) • *(small) boy (likes the nice girl)

  6. Structure in StringsProposal 2 • Some words: the a small nice big very boy girl sees likes • Some good sentences: • (the boy) likes (a girl) • (the small girl) likes (the big girl) • (a very small nice boy) sees (a very nice boy) • Some bad sentences: • *(the boy)(the girl) • *(small boy) likes (the nice girl)

  7. More Structure in StringsProposal 2 -- ctd • Some words: the a small nice big very boy girl sees likes • Some good sentences: • ((the) boy) likes ((a) girl) • ((the) (small) girl) likes ((the) (big) girl) • ((a) ((very) small) (nice) boy) sees ((a) ((very) nice) girl) • Some bad sentences: • *((the) boy)((the) girl) • *((small) boy) likes ((the) (nice) girl)

  8. likes boy girl the a From Substrings to Trees • (((the) boy) likes ((a) girl))

  9. Context-Free Grammars • Terminals • This would be the lexicon/vocabulary • Non-Terminals • The constituents in a language • Like noun phrase, verb phrase, prepositional phrase and sentence • Rules • Rules consist of a single non-terminal on the left and any number of terminals and non-terminals on the right. • Describe the allowed structure of the constituents • Express the ways in which symbols of the language can be grouped or ordered together

  10. S nonterminal symbols = constituents NP likes NP boy girl DetP DetP the a terminal symbols = words Phrase Structure Tree • (((the/Det) boy/N) likes/V((a/Det) girl/N)) Phrase-structure tree

  11. Context? • The notion of context in CFGs is not the same as the ordinary meaning of the word context in language. • All it really means is that the non-terminal on the left-hand side of a rule is out there all by itself • A -> B C • Means that I can rewrite an A as a B followed by a C regardless of the context in which A is found

  12. CFG: Example • Many possible CFGs for English, here is an example (fragment): • S  NP VP • VP  V NP • NP  DetP N | AdjP NP • AdjP  Adj | Adv AdjP • N  boy | girl • V  sees | likes • Adj  big | small • Adv  very • DetP  a | the the very small boy likes a girl

  13. Derivations in a CFG S  NP VP VP  V NP NP  DetP N | AdjP NP AdjP  Adj | Adv AdjP N  boy | girl V  sees | likes Adj  big | small Adv  very DetP  a | the S S

  14. Derivations in a CFG S  NP VP VP  V NP NP  DetP N | AdjP NP AdjP  Adj | Adv AdjP N  boy | girl V  sees | likes Adj  big | small Adv  very DetP  a | the NP VP S NP VP

  15. Derivations in a CFG S  NP VP VP  V NP NP  DetP N | AdjP NP AdjP  Adj | Adv AdjP N  boy | girl V  sees | likes Adj  big | small Adv  very DetP  a | the DetP N VP S NP VP DetP N

  16. Derivations in a CFG S  NP VP VP  V NP NP  DetP N | AdjP NP AdjP  Adj | Adv AdjP N  boy | girl V  sees | likes Adj  big | small Adv  very DetP  a | the the boy VP S NP VP DetP N boy the

  17. Derivations in a CFG S  NP VP VP  V NP NP  DetP N | AdjP NP AdjP  Adj | Adv AdjP N  boy | girl V  sees | likes Adj  big | small Adv  very DetP  a | the the boy likes NP S NP VP DetP N V NP the boy likes

  18. Derivations in a CFG S  NP VP VP  V NP NP  DetP N | AdjP NP AdjP  Adj | Adv AdjP N  boy | girl V  sees | likes Adj  big | small Adv  very DetP  a | the the boy likes a girl S NP VP DetP N V NP the boy likes N DetP girl a

  19. Simple lexicon

  20. Simple grammar

  21. Generativity • We can view these rules as either analysis or synthesis machines • Generate strings in the language • Reject strings not in the language • Impose structures (trees) on strings in the language

  22. A CFG defines a formal language • Sentences (strings of words) that can be derived by the grammar are in the formal language defined by the grammar • Sentences that cannot be derived from the grammar are not in the language • Ungrammatical

  23. Derivations • A derivation is a sequence of rules applied to a string that accounts for that string • Covers all the elements in the string • Covers only the elements in the string

  24. Recursion • We’ll have to deal with rules such as the following where the non-terminal on the left also appears somewhere on the right (directly). • NP -> NP PP [[The flight] [to Boston]] • VP -> VP PP [[departed Miami] [at noon]]

  25. Recursion • Of course, this is what makes syntax interesting • flights from Denver • Flights from Denver to Miami • Flights from Denver to Miami in February • Flights from Denver to Miami in February on a Friday • Flights from Denver to Miami in February on a Friday under $300 • Flights from Denver to Miami in February on a Friday under $300 with lunch

  26. The Point • If you have a rule like • VP -> V NP • It only cares that the thing after the verb is an NP. It doesn’t have to know about the internal affairs of that NP

  27. The Point • VP -> V NP • I hate • flights from Denver • Flights from Denver to Miami • Flights from Denver to Miami in February • Flights from Denver to Miami in February on a Friday • Flights from Denver to Miami in February on a Friday under $300 • Flights from Denver to Miami in February on a Friday under $300 with lunch

  28. Potential Problems in CFG • Agreement • Subcategorization • Movement

  29. Agreement • By agreement, we have in mind constraints that hold among various constituents that take part in a rule or set of rules • For example, in English, determiners and the head nouns in NPs have to agree in their number. *This flights *Those flight This flight Those flights

  30. Problem • Our earlier NP rules are clearly deficient since they don’t capture this constraint • NP  Det Nominal • Accepts, and assigns correct structures, to grammatical examples (this flight) • But its also happy with incorrect examples (*these flight) • Such a rule is said to overgenerate.

  31. Verb Phrases • English VPs consist of a head verb along with 0 or more following constituents which we’ll call arguments.

More Related