1 / 32

Parse Your Heart Out

Parse Your Heart Out. May 11 th , 1999. Announcements. Assignment 4 today Matlab manuals Project rough drafts. A Translation Experiment. Rheingold Tries to Revive Brand by Marketing a 'Manly' Beer.

hasad-bryan
Download Presentation

Parse Your Heart Out

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. Parse Your Heart Out May 11th, 1999 CS251: Intro to AI/Lisp II

  2. Announcements • Assignment 4 today • Matlab manuals • Project rough drafts CS251: Intro to AI/Lisp II

  3. A Translation Experiment CS251: Intro to AI/Lisp II

  4. Rheingold Tries to Revive Brand by Marketing a 'Manly' Beer Striving to put the "gold" back in Rheingold, the top executives in charge of reviving the venerable New York beer brand are revamping their marketing efforts with an overhaul that includes a new agency. Rheingold Brewing Co. has hired DeVito/Verdi in New York, an agency known for sharply humorous creative work for advertisers like New York magazine and Office Depot. DeVito/Verdi succeeds Ferrell Calvillo Communications in New York, which handled the account during the brand's initial reintroduction last year. Along with the agency change comes a Web site, www.rheingoldbeer.com, created by Compelling Content, an Internet agency in New York, and an increased focus on male beer drinkers ages 21 to 34. As a result, the ads in year two assume a jocular, hypermasculine tone to promote Rheingold as the brew "for the few real men still left." CS251: Intro to AI/Lisp II NY Times, 5/11/99

  5. Bemühend, das " Gold ", das in Rheingold einzusetzen rückseitig ist, revamping die oberen Leitprogramme verantwortlich für das Wieder beleben der venerable New Yorkbiermarke ihre Marketing-Bemühungen mit einer Überholung, die eine neue Agentur umfaßt. Rheingold, das Co. braut, hat DeVito/Verdi in New York, eine Agentur angestellt, die für scharf humorvolle kreative Arbeit für Inserenten wie New Yorkzeitschrift und Bürodepot bekannt ist. DeVito/Verdi folgt Kommunikationen Ferrell Calvillo mit New York, das das Konto während der Ausgangswiedereinführung der Marke letztes Jahr anfaßte. Zusammen mit Agentur kommt die Änderung eine Web site, www.rheingoldbeer.com, erstellt, indem sie Inhalt, eine Internet-zwingt, Agentur in New York und ein erhöhter Fokus auf männlichem Biertrinkeralter 21 bis 34. Infolgedessen nehmen das ADS in Jahr zwei jocular, hypermasculineton an, um Rheingold als brauen " für die wenigen wirklichen Männer noch zu fördern nach links. " CS251: Intro to AI/Lisp II

  6. Endeavoring, revamping the upper guidance programs responsible for the again the venerable new Yorkbiermarke their marketing efforts with an overhaul, which covers a new agency, animate the " gold ", which is backlateral in Rhine gold to begin. Rhine gold, which brews CO, employed DeVito/Verdi in New York, an agency, which admits for sharply humorous creative work for advertisers like new Yorkzeitschrift and office depot is. DeVito/Verdi follows communications Ferrell Calvillo with New York, which touched the account during the output re-establishment of the label last year. Together with agency the modification a web site, www.rheingoldbeer.com, comes created, by Internet-forcing contents of, one, agency into New York and a increased focus on male beer drunkard age 21 to 34. Consequently the ADS assumes in year two jocular, hypermasculineton, around Rhine gold as brews " for the few real men to promote after still left ", the makeover for the label -- formally dry CS251: Intro to AI/Lisp II

  7. Striving to put the "gold" back in Rheingold, the top executives in charge of reviving the venerable New York beer brand are revamping their marketing efforts with an overhaul that includes a new agency. Rheingold Brewing Co. has hired DeVito/Verdi in New York, an agency known for sharply humorous creative work for advertisers like New York magazine and Office Depot. DeVito/Verdi succeeds Ferrell Calvillo Communications in New York, which handled the account during the brand's initial reintroduction last year. Endeavoring, revamping the upper guidance programs responsible for the again the venerable new Yorkbiermarke their marketing efforts with an overhaul, which covers a new agency, animate the " gold ", which is backlateral in Rhine gold to begin. Rhine gold, which brews CO, employed DeVito/Verdi in New York, an agency, which admits for sharply humorous creative work for advertisers like new Yorkzeitschrift and office depot is. DeVito/Verdi follows communications Ferrell Calvillo with New York, which touched the account during the output re-establishment of the label last year. CS251: Intro to AI/Lisp II NY Times, 5/11/99

  8. Along with the agency change comes a Web site, www.rheingoldbeer.com, created by Compelling Content, an Internet agency in New York, and an increased focus on male beer drinkers ages 21 to 34. As a result, the ads in year two assume a jocular, hypermasculine tone to promote Rheingold as the brew "for the few real men still left." Together with agency the modification a web site, www.rheingoldbeer.com, comes created, by Internet-forcing contents of, one, agency into New York and a increased focus on male beer drunkard age 21 to 34. Consequently the ADS assumes in year two jocular, hypermasculineton, around Rhine gold as brews " for the few real men to promote after still left ", the makeover for the label -- formally dry CS251: Intro to AI/Lisp II NY Times, 5/11/99

  9. Endeavoring, revamping the upper guidance programs responsible for the again the venerable new Yorkbiermarke their marketing efforts with an overhaul, which covers a new agency, animate the " gold ", which is backlateral in Rhine gold to begin. Rhine gold, which brews CO, employed DeVito/Verdi in New York, an agency, which admits for sharply humorous creative work for advertisers like new Yorkzeitschrift and office depot is. DeVito/Verdi follows communications Ferrell Calvillo with New York, which touched the account during the output re-establishment of the label last year. Together with agency the modification a web site, www.rheingoldbeer.com, comes created, by Internet-forcing contents of, one, agency into New York and a increased focus on male beer drunkard age 21 to 34. Consequently the ADS assumes in year two jocular, hypermasculineton, around Rhine gold as brews " for the few real men to promote after still left ", the makeover for the label -- formally dry CS251: Intro to AI/Lisp II

  10. A Little Vocab • Formal language is a set of strings • A string is a set of terminal symbols • Phrase structure: Strings have structure • S, NP, VP • In CFG (BNF), rewrite rules consist of a single nonterminal symbol on the left-hand side CS251: Intro to AI/Lisp II

  11. For Example S NP VP | S Conjunction S NP Pronoun | Noun | Art Noun | NP PP | NP RelClause VP Verb | NP VP | VP Adjective | VP PP | VP Adverb PP Preposition NP RelClause that VP CS251: Intro to AI/Lisp II

  12. The Lexicon Noun stench | breeze | glitter | pit | gold nothing | wumpus | pits Verb is | see | smell | … Adjective Adverb CS251: Intro to AI/Lisp II

  13. More Terms • Lexicon: The terms in the vocabulary • Categories/parts of speech • Noun, verb, adjective, adverb • Article, preposition, conjunction, pronoun CS251: Intro to AI/Lisp II

  14. What’s Wrong with the Grammar We’ve Got? • Overgeneration CS251: Intro to AI/Lisp II

  15. Grammars, Grammars, Everywhere • Chomsky again: Transformational grammar maps from surface structure to deep structure • ATN grammars: Rules are represented in a directed graph • Put it in the lexicon • Lexical functional grammar • Categorial grammar CS251: Intro to AI/Lisp II

  16. Semantic Grammars • Avast ye scurvy dogs, throw the syntax overboard CS251: Intro to AI/Lisp II

  17. Parsing for Fun & Profit CS251: Intro to AI/Lisp II

  18. Parsing from the Top-Down • Start with S, and expand from there • State of the parse • Symbol list is a list of symbols that have resulted from the set of operations applied so far • Use a lexicon cried: V dogs: N, V the: ART CS251: Intro to AI/Lisp II

  19. Revised State • State of parse is now a pair • Symbol list • Position in sentence 1 The 2 cats 3 howled 4 CS251: Intro to AI/Lisp II

  20. A Top-Down Parser • Possibilities list: List of possible states • Current state is the car • Backup states are the cdr • (((N) 2) ((NAME) 1) ((ADJ N) 1)) CS251: Intro to AI/Lisp II

  21. Top-Down Algorithm • 1) Select current state, say C, with car(Possibilities), if C is nil, fail • 2) If C is an empty symbol list and word position is at end, succeed, else: • Generate next possible states: • a) If first symbol on C’s symbol list is a lexical symbol and next word in sentence can be that class then create a new state by removing first symbol and update word position, add it to the possibilities list • b) Not a lexical symbol, then generate a new state for each applicable rule in the grammar and add them all to the possibilities list • Start with initial state ((S) 1) and no backup states CS251: Intro to AI/Lisp II

  22. Parsing is Search • Initial state • Operators • Goal • States • Path cost? CS251: Intro to AI/Lisp II

  23. Depth-first & Breadth-first • Depth-first • Left recursive rules • Breadth-first CS251: Intro to AI/Lisp II

  24. Bottom-up Parsing • Group strings and match them to rules • State would be a symbol list • Start with all the words in the sentence • Successor states • Rewrite a word with lexical categories • Replace RHS sequence by its LHS symbol CS251: Intro to AI/Lisp II

  25. Bottom-up Trouble Have the students in Section 1 of CS 251 take a pop midterm. Have the students in Section 1 of CS 251 taken a pop midterm? CS251: Intro to AI/Lisp II

  26. Keep a Chart • Chart is just a data structure • Track matches in terms of keys • Look for rules that either start with a key, or • Earlier rules that need the key in the current position • What’s on the chart? • All constituents derived from the sentence so far in the parse • Partial matches: Active arcs CS251: Intro to AI/Lisp II

  27. Chart Parsing • Combine an active ac with a completed constituent • Agenda is a list of newly completed constituents CS251: Intro to AI/Lisp II

  28. Chart-Parse (defun chart-parse (words &optional (*grammar* *grammar*)) "See if the string of words can be parsed by the grammar." (let ((chart (make-chart :ends-at (make-array (+ 1 (length words)) :initial-element nil)))) (add-edge (edge 0 0 'S* nil (list (grammar-start-symbol *grammar*))) chart 'initializer) (for v = 0 to (- (length words) 1) do (scanner v (elt words v) chart)) chart)) CS251: Intro to AI/Lisp II

  29. Scanner (defun scanner (j word chart) "Add edges everywhere WORD is expected." (for each cat in (categories-for word *grammar*) do (dprint "scanner:" cat (elt (chart-ends-at chart) j)) (when (member cat (elt (chart-ends-at chart) j) :test #'unify :key #'edge-expects) (add-edge (edge j (+ j 1) cat (list word) nil) chart 'scanner)))) CS251: Intro to AI/Lisp II

  30. Predictor (defun predictor (edge chart) "Add edges saying what we expect to see here." (for each rule in (rewrites-for (op (edge-expects edge)) *grammar*) do (add-edge (edge (edge-end edge) (edge-end edge) (rule-lhs rule) nil (rule-rhs rule)) chart 'predictor))) CS251: Intro to AI/Lisp II

  31. Completer (defun completer (edge chart) "Use this edge to extend any edges in the chart." (for each old-edge in (elt (chart-ends-at chart) (edge-start edge)) do (let ((b (unify (edge-lhs edge) (edge-expects old-edge) (edge-bindings old-edge)))) (when b (add-edge (edge (edge-start old-edge) (edge-end edge) (edge-lhs old-edge) (cons edge (edge-found old-edge)) (rest (edge-remains old-edge)) b) chart 'completer))))) CS251: Intro to AI/Lisp II

  32. Add-Edge (defun add-edge (edge chart &optional reason) "Put edge into chart, and complete or predict as appropriate." (unless (member edge (elt (chart-ends-at chart) (edge-end edge)) :test #'edge-equal) (when (handle-augmentation *grammar* edge) (push edge (elt (chart-ends-at chart) (edge-end edge))) (dprint reason edge);; debugging output (as in ;; Figure 23.4, [p 700]) (if (complete? edge) (completer edge chart) (predictor edge chart))))) CS251: Intro to AI/Lisp II

More Related