1 of 22

Syntax: Introduction

Till now, we have discussed:

Language modeling — understanding ordering of words POS tagging — understanding roles of words

Now we will discuss more complex notions, such as grammatical relations among words

2 of 22

What is Syntax?

Pawan Goyal (IIT Kharagpur)

2 / 14

Syntax

Refers to the way words are arranged together, and the relationship between then.

Grammar

Compositionality

Problem:

- “Ambiguity”

Week 5: Lecture 1

3 of 22

Syntax Tree: Example

Pawan Goyal (IIT Kharagpur)

3 / 14

Syntax

Sentence: The man read this book

We wish to understand how different words in a sentence are grouped, e.g., a Det and a Noun can together give a Noun Phrase, a Noun Phrase preceded by a verb can give a Verb phrase, etc.

Week 5: Lecture 1

Our final goal:

How to construct a syntax tree for a given sentence?

4 of 22

Defining the notions: Constituency

Pawan Goyal (IIT Kharagpur)

Syntax

Constituent

A group of words acts as a single unit - phrases, clauses etc.

Week 5: Lecture 1

4 / 14

the man from Amherst – NP (man: head word)

extremely clever – AP (clever: head word)

down the river – PP (down: head word)

killed the rabbit – VP (killed: head word)

5 of 22

Defining the notions: Constituency

Pawan Goyal (IIT Kharagpur)

Syntax

Constituent

A group of words acts as a single unit - phrases, clauses etc.

Part of Speech - “Substitution Test"

Constituency: Noun Phrase

Kermit the frog they

December twenty-sixth

the reason he is running for president

Similarly, different word-sequences (phrases) can be used as a substitute for each other.

E.g., noun phrases

Week 5: Lecture 1

4 / 14

Different words having the same POS (here, adjective)

The {sad, intelligent, green, fat, ...} one is in the corner. can be used as a substitute

for each other.

6 of 22

Pawan Goyal (IIT Kharagpur)

Syntax

Evidence that constituency exists

They appear in similar environments

Week 5: Lecture 1

6 / 14

7 of 22

Pawan Goyal (IIT Kharagpur)

Syntax

Evidence that constituency exists

They appear in similar environments

Week 5: Lecture 1

6 / 14

8 of 22

Evidence that constituency exists

Pawan Goyal (IIT Kharagpur)

Syntax

They appear in similar environments

Can be placed in a number of different locations

Week 5: Lecture 1

6 / 14

9 of 22

Evidence that constituency exists

Pawan Goyal (IIT Kharagpur)

Syntax

They appear in similar environments

Can be placed in a number of different locations

Week 5: Lecture 1

6 / 14

10 of 22

Modeling Constituency: what tool do we need?

Pawan Goyal (IIT Kharagpur)

7 / 14

Syntax

Basically, we want tools to understand which words (in a given text) come together as a unit.

E.g., which words together make up a noun phrase?

Week 5: Lecture 1

11 of 22

Modeling Constituency

Pawan Goyal (IIT Kharagpur)

Syntax

Context-free grammar

The most common way of modeling constituency

Consists of production Rules

These rules express the ways in which the symbols of the language can be grouped and ordered together

Week 5: Lecture 1

8 / 14

12 of 22

Modeling Constituency

Pawan Goyal (IIT Kharagpur)

Syntax

 

Week 5: Lecture 1

8 / 14

13 of 22

CFG for Languages

Pawan Goyal (IIT Kharagpur)

9 / 14

Syntax

 

Week 5: Lecture 1

14 of 22

CFG for Languages

Pawan Goyal (IIT Kharagpur)

Syntax

Example

 

“Noun”, “ProperNoun”, “Det” are pre-terminals.

Week 5: Lecture 1

10 / 14

But we cannot generate any string with these rules, since there is no terminal.

15 of 22

CFG for Languages

Pawan Goyal (IIT Kharagpur)

Syntax

 

Week 5: Lecture 1

10 / 14

NLP is highly context-sensitive BTW

16 of 22

CFG as a generator

 

Pawan Goyal (IIT Kharagpur)

Syntax

Week 5: Lecture 1

11 / 14

17 of 22

CFG as a generator

 

Pawan Goyal (IIT Kharagpur)

Syntax

Week 5: Lecture 1

11 / 14

18 of 22

CFG as a generator

 

Pawan Goyal (IIT Kharagpur)

Syntax

Week 5: Lecture 1

11 / 14

19 of 22

CFG as a generator

Pawan Goyal (IIT Kharagpur)

Syntax

 

Week 5: Lecture 1

11 / 14

20 of 22

CFGs and Grammaticality

Pawan Goyal (IIT Kharagpur)

12 / 14

Syntax

A CFG defines a formal language = set of all sentences (string of words) that can be derived by the grammar

Sentences in this set are said to be grammatical

Sentences outside this set are said to be ungrammatical

Week 5: Lecture 1

21 of 22

CFGs and Recursion

Pawan Goyal (IIT Kharagpur)

Syntax

 

Week 5: Lecture 1

13 / 14

22 of 22

CFGs and Recursion

Pawan Goyal (IIT Kharagpur)

Syntax

 

Example Sentence

[SThe mailman ate his [NP lunch [PP with his friend [PP from the cleaning staff

[PP of the building [PP at the intersection [PP on the north end [PP of town]]]]]]].

start of a NP

start of a NP

start of a NP

Week 5: Lecture 1

13 / 14

start of a NP

start of a NP