NLP. Introduction to NLP Is language more than just a “bag of words”? Grammatical rules apply to categories and groups of words, not individual words.

Slides:



Advertisements
Similar presentations
Chapter 4 Syntax Part IV.
Advertisements

The Structure of Sentences Asian 401
Sentence Construction and the Syntactical Tree forms Lecture 6 Feed back of mid-test.
Parts of a Sentence Review. Define each of the following: Adjective Adjective Modifies a noun Modifies a noun Adverb Adverb Modifies a verb, adverb, and.
FSG, RegEx, and CFG Chapter 2 Of Sag’s Syntactic Theory.
Grammars, constituency and order A grammar describes the legal strings of a language in terms of constituency and order. For example, a grammar for a fragment.
Dr. Abdullah S. Al-Dobaian1 Ch. 2: Phrase Structure Syntactic Structure (basic concepts) Syntactic Structure (basic concepts)  A tree diagram marks constituents.
Properties of X-bar Complements, Adjuncts, & Specifiers.
Syntax: The Sentence Patterns of Language
SYNTAX Introduction to Linguistics. BASIC IDEAS What is a sentence? A string of random words? If it is a sentence, does it have to be meaningful?
The study of how words combine to form grammatical sentences.
Syntax 2nd class Chapter 4.
Natural Language Processing - Feature Structures - Feature Structures and Unification.
Matakuliah: G0922/Introduction to Linguistics Tahun: 2008 Session 11 Syntax 2.
1 Introduction to Computational Linguistics Eleni Miltsakaki AUTH Fall 2005-Lecture 2.
Syntax LING October 11, 2006 Joshua Tauberer.
Phrase Structure Rules
1 CSC 594 Topics in AI – Applied Natural Language Processing Fall 2009/ Outline of English Syntax.
Lect. 11Phrase structure rules Learning objectives: To define phrase structure rules To learn the forms of phrase structure rules To compose new sentences.
Phrase Structure The formal means of representing constituency.
Chapter 2 A rapid overview.
Syntax Nuha AlWadaani.
THE PARTS OF SYNTAX Don’t worry, it’s just a phrase ELL113 Week 4.
Phrases and Sentences: Grammar
11 CS 388: Natural Language Processing: Syntactic Parsing Raymond J. Mooney University of Texas at Austin.
Constituents  Sentence has internal structure  The structures are represented in our mind  Words in a sentence are grouped into units, and these units.
LI 2013 NATHALIE F. MARTIN S YNTAX. Grammatical vs Ungrammatical.
1 LIN 1310B Introduction to Linguistics Prof: Nikolay Slavkov TA: Qinghua Tang CLASS 14, Feb 27, 2007.
Chapter 4 Syntax Part II.
Introduction to Linguistics
Syntax.
1.Syntax: the rules of sentence formation; the component of the mental grammar that represent speakers’ knowledge of the structure of phrase and sentence.
CS : Speech, Natural Language Processing and the Web/Topics in Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 12: Deeper.
Syntax.
Syntax I: Constituents and Structure Gareth Price – Duke University.
IV. SYNTAX. 1.1 What is syntax? Syntax is the study of how sentences are structured, or in other words, it tries to state what words can be combined with.
Chapter 4 Syntax. Objectives 1. To understand the definition of syntax 2. To study 2 ways of analyzing sentence structure 3. To learn about the syntactical.
Natural Language Processing Lecture 6 : Revision.
Today Phrase structure rules, trees Constituents Recursion Conjunction
GrammaticalHierarchy in Information Flow Translation Grammatical Hierarchy in Information Flow Translation CAO Zhixi School of Foreign Studies, Lingnan.
PARSING David Kauchak CS159 – Spring 2011 some slides adapted from Ray Mooney.
Notes on Pinker ch.7 Grammar, parsing, meaning. What is a grammar? A grammar is a code or function that is a database specifying what kind of sounds correspond.
Culture , Language and Communication
Parsing with Context-Free Grammars for ASR Julia Hirschberg CS 4706 Slides with contributions from Owen Rambow, Kathy McKeown, Dan Jurafsky and James Martin.
Review of basic concepts.  The knowledge of sentences and their structure.  Syntactic rules include: ◦ The grammaticality of sentences ◦ Word order.
Rules, Movement, Ambiguity
CSA2050 Introduction to Computational Linguistics Parsing I.
Making it stick together…
Syntax II “I really do not know that anything has ever been more exciting than diagramming sentences.” --Gertrude Stein.
1 Introduction to Computational Linguistics Eleni Miltsakaki AUTH Spring 2006-Lecture 2.
SYNTAX.
◦ Process of describing the structure of phrases and sentences Chapter 8 - Phrases and sentences: grammar1.
Syntax 3rd class Chapter 4. Syntactic Categories 1. That glass suddenly broke. 2. A jogger ran toward the end of the lane. 3. These dead trees might block.
GRAMMARS David Kauchak CS457 – Spring 2011 some slides adapted from Ray Mooney.
1 Some English Constructions Transformational Framework October 2, 2012 Lecture 7.
1 Chapter 4 Syntax Part III. 2 The infinity of language pp The number of sentences in a language is infinite. 2. The length of sentences is.
CSA3050: NLP Algorithms Sentence Grammar NLP Algorithms.
3.3 A More Detailed Look At Transformations Inversion (revised): Move Infl to C. Do Insertion: Insert interrogative do into an empty.
NLP. Introduction to NLP #include int main() { int n, reverse = 0; printf("Enter a number to reverse\n"); scanf("%d",&n); while (n != 0) { reverse =
Syntax II. Specifiers Specifiers tell us more information about nouns, verbs, adjectives, adverbs and prepositions The, a, this, three, some, many etc.
College of Science and Humanity Studies, Al-Kharj.
King Faisal University جامعة الملك فيصل Deanship of E-Learning and Distance Education عمادة التعلم الإلكتروني والتعليم عن بعد [ ] 1 King Faisal University.
Beginning Syntax Linda Thomas
Chapter Eight Syntax.
Part I: Basics and Constituency
Chapter Eight Syntax.
Natural Language - General
Introduction to Linguistics
David Kauchak CS159 – Spring 2019
Presentation transcript:

NLP

Introduction to NLP

Is language more than just a “bag of words”? Grammatical rules apply to categories and groups of words, not individual words. Example – a sentence includes a subject and a predicate. The subject is a noun phrase and the predicate is a verb phrase. –Noun phrase: The cat, Samantha, She –Verb phrase: arrived, went away, had dinner When people learn a new word, they learn its syntactic usage. –Examples: wug (n), cluvious (adj) – use them in sentences –Hard to come up with made up words: forkle, vleer, etc. all taken.

What do nouns typically have in common? –E.g., can be preceded by “the”. What about verbs? –Verbs can be preceded by “can’t”. Adjectives can come between “the” and a noun. How is this different from grade school definitions? Determiners: a, the, many, no, five Prepositions: for, to, in, without, before

How do we think of words like cat, run, five? –pronunciation, part of speech, meaning Five: /fa ɪ v/, numeral, “5” Ambiguity

Constituents are continuous Constituents are non-crossing –if two constituents share one word, then one of them must completely contain the other. Each word is a constituent

“coordination” test “pronoun” test –A small dog is barking in the park. –It is barking in the park “question by repetition” test: –I have seen blue elephants –Blue elephants? –* Seen blue? –Seen blue elephants? “topicalization” test: –Blue elephants, I have seen. “question” test: –What have I seen? “deletion” test –Last year I saw a blue elephant in the zoo. “semantic” test “intuitition” test

One way: tree structure –Generate the tree structure first –Then fill the leaf nodes with terminals

The simplest rule for a sentence, e.g. “Birds fly” S  N V

N  Samantha | Min | Jorge V  left | sang | walked Sample sentences: Samantha sang Jorge left

The verbs so far were intransitive (no direct object) What rules are needed next? –Transitive verbs and direct objects (“Jorge saw Samantha”) –Determiners (“the cats”) Combinatorial explosion (even for the simplest form of sentences) Need for noun phrases Ditto for verb phrases

S  NP VP NP  DT N VP  V NP DT  the | a N  child | cat | dog V  took | saw | liked | scared | chased Sample sentences: a dog chased the cat the child saw a dog

Different expansions of a category are delineated with ”|” – NP  PN | DT CN One rule for proper nouns and another for common nouns

S  NP VP NP  DT CN NP  PN VP  V NP DT  the | a CN  child | cat | dog PN  Samantha | Jorge | Min V  took | saw | liked | scared | chased Sample sentences: a child scared Jorge Min took the child

Wherever N is allowed in a sentence, – DT N – JJ N – DT JJ N are also allowed We can use the notation for alternatives – NP  N | DT N | JJ N | DT JJ N Optional categories can be also marked using parentheses: – NP  (DT) (JJ) N

Samantha ran. Samantha ran to the park. Samantha ran away. Samantha bought a cookie. Samantha bought a cookie for John. Overall structure: VP  V(NP)(P)(NP)

S  NP VP NP  DT CN NP  PN VP  V (NP) (P) (NP) DT  the | a CN  child | cat | dog PN  Samantha | Jorge | Min P  to | for | from | in V  took | saw | liked | scared | chased | gave Sample sentences: Samantha saw the cat Jorge gave the cat to Min

Examples: –Mary bought a book for John in a bookstore. –The bookstore sells magazines. –The bookstore on Main St. sells magazines. –Mary ran away. –Mary ran down the hill. Changes are needed to both NP and VP to accommodate prepositional phrases –Wherever a preposition is allowed, it can be followed by a noun phrase. –Run up –NP can contain any number of PPs but only up to two NPs. How do we revise the grammar accordingly?

S  NP VP NP  (DT) (JJ) N (PP) VP  V (NP) (PP) PP  P (NP)

The boy saw the woman with the telescope. PP  PREP NP VP  V NP PP VP  V NP NP  DT N NP  DT N PP

(JJ*) = a sequence of zero or more JJ Are all sequences of adjectives allowed? –a big red house –* a red big house Adjective ordering in English depends on semantics!

The Little Red Riding Hood Three Little Pigs The Three Musketeers The Steadfast Tin Soldier The French Connection Old Macdonald Five Golden Rings The Ancient Mariner

Det Number Strength Size Age Shape Color Origin Material Purpose Noun det < number < size < color < purpose < noun strength < material < noun origin < noun

Examples: –I don’t recall whether I took the dog out. –Do you know if the mall is still open? VP  V (NP) (NP) (C S) (PP*) Can (C S) appear inside an NP? –Whether he will win the elections remains to be seen.

S can generate VP, VP can generate S NP can generate PP, PP can generate NP What does recursion allow? Is there a longest sentence in English? Conjunction of NPs: NP  NP and NP Conjunction of PPs: PP  PP and PP Conjunction of VPs: VP  VP and VP

S  NP VP –NP  (DT) (JJ) N (PP) –VP  V (NP) (PP) –PP  P (NP) Is there a meta-pattern here? –XP  (specifier) X’ –X’  X (complement) Example: NP  DT N’ X-bar Theory –

Conjunction – X  X and X This kind of rule even covers entire sentences – S  S and S

Is “Aux V” a constituent? –I have seen blue elephants and will remember them forever. Recursion: –VP -> Aux VP –Raj may have been sleeping. Is such recursion unlimited?

Grammar: – S  NP VP | CP VP – NP  (DT) (JJ*) N (CP) (PP*) – VP  V (NP) (NP) (PP*) | V (NP) (CP) (PP*) – PP  P NP – CP  C S What rules are needed to generate these three sentences: –1. The small dog of the neighbors brought me an old tennis ball. –2. That wugs have three eyes is unproven by scientists. –3. I saw the gift that the old man gave me at the meeting.

NLP