Overview Grammars and trees; Cognitive Modeling competence vs. - - PowerPoint PPT Presentation

overview
SMART_READER_LITE
LIVE PREVIEW

Overview Grammars and trees; Cognitive Modeling competence vs. - - PowerPoint PPT Presentation

Overview Grammars and trees; Cognitive Modeling competence vs. performance; Lecture 9: Language Processing ambiguity; dimensions of parsing; Frank Keller School of Informatics a parallel parser; University of Edinburgh


slide-1
SLIDE 1

Cognitive Modeling

Lecture 9: Language Processing

Frank Keller School of Informatics University of Edinburgh

keller@inf.ed.ac.uk

Cognitive Modeling: Language Processing – p.1

Overview

Grammars and trees; competence vs. performance; ambiguity; dimensions of parsing; a parallel parser; left-corner parsing; a serial parser.

Reading: Cooper (2002, Ch. 7).

Cognitive Modeling: Language Processing – p.2

Introduction

Linguistics deals with:

phonology: the sounds of the language; syntax: the structure of sentences (word order, etc.); semantics: the meaning of sentences; pragmatics: the use of language in context; non-literal

meaning. Psycholinguistics studies the comprehension and production of language on all these level. Here we will focus on syntactic processing (aka sentence processing, parsing).

Cognitive Modeling: Language Processing – p.3

A Small Grammar of English

Phrase markers: S: sentence, NP: noun phrase, VP: verb phrase Syntactic categories (aka parts of speech): Det: determiner, CN: common noun, TV: transitive verb Phrase structure rules: S

NP VP NP

Det CN VP

TV NP Det

the CN

cat TV

bit CN

dog

Cognitive Modeling: Language Processing – p.4

slide-2
SLIDE 2

Syntax Tree

The grammar rules generate a syntax tree for sentences like the cat bit the dog: S NP Det The CN cat VP TV bit NP Det the CN dog

Cognitive Modeling: Language Processing – p.5

More Phrase Structure Rules

NP

Pro pronoun NP

PN proper name PP

Prep NP prepositional phrase VP

IV intransitive verb VP

DV NP NP ditransitive verb VP

DV NP PP ditransitive verb with PP comple- ment VP

Vinf1 VP(inf) verb with infinitival complement VP

Vinf2 NP VP(inf) verb with NP and infinitival comple- ment VP(inf)

INF VP infinitival NP S(comp)

Comp S complement sentence

Cognitive Modeling: Language Processing – p.6

Competence vs. Performance

Competence: the linguistic knowledge that a speaker has; formalized, e.g., using phrase structure rules. Performance: the application of the linguistic knowledge in comprehending and producing language. Competence is idealized, while performance is subject to cognitive constraints (e.g., memory limitations, fatigue). Psycholinguistics deals with performance (competence is the domain of linguistic theory). We will focus on the Human Sentence Processing Mechanism (HPSM), i.e., the cognitive device that assigns a syntactic structure to a string of words.

Cognitive Modeling: Language Processing – p.7

Ambiguity

The HPSM has to deal with the fact that many sentences are ambiguous, i.e., have more than one reading. Some famous examples: (1) a. The horse raced past the barn fell. b. Since Jay jogs a mile seems a small distance to him. c. Teachers taught by the Berlitz methods passed the test. d. The officer told the criminal that he was arresting her husband. The HPSM is led up the garden path, i.e., it does not compute the correct (grammatical) reading of these sentences (at least initially).

Cognitive Modeling: Language Processing – p.8

slide-3
SLIDE 3

Dimensions of Parsing

A number of properties are important when designing a model

  • f the HPSM:

Incrementality: the parser can be incremental (process a word at a time), or non-incremental (process whole sentences). Good evidence that the HPSM is incremental. Directionality: the parser can process sentence bottom-up (from the words up) or top-down (from the phrase markers down). Evidence that the HPSM combines both strategies.

Cognitive Modeling: Language Processing – p.9

Dimensions of Parsing

Parallelism: a serial parser maintains only one structure at a time; a parallel parser pursues several (or all) possible structures. Controversial issue; evidence for both serialism and limited parallelism. Interactivity: the parser can be encapsulated (only has access to syntactic information) or interactive (has access to semantic information and context). Evidence for limited interactivity.

Cognitive Modeling: Language Processing – p.10

An Incremental Input Module

We first need to create an input module that presents one stimulus word at a time: Rule 1: Select a sentence to parse for the Stimuli buffer: IF the current cycle is 1

  • nce WordList is in Stimuli

THEN delete WordList from Stimuli add words(WordList) to Current Stimulus Rule 2: When quiescent, feed one more word to the subject: TRIGGER system_quiescent IF words([Head|Tail]) is in Current Stimulus THEN delete words([Head|Tail]) from Current Stimulus add words(Tail) to Current Stimulus send word(Head) to Subject:Input/Output

Cognitive Modeling: Language Processing – p.11

A Bottom-Up Parallel Parser

The parser constructs a Chart, a compact representation of all the analyses of a sentence. Goal: find an S edge that spans the whole sentence. Example:

The dog kittens bite the cn det tv det cn np np vp s

Cognitive Modeling: Language Processing – p.12

slide-4
SLIDE 4

A Bottom-Up Parallel Parser

Architecture of a simple parser that constructs the chart bottom-up:

Cognitive Modeling: Language Processing – p.13

Chart, Lexicon, Grammar Rules

The chart edges are represented as predicates of the form: edge(LeftVertex,RightVertex,Content,Level) where LeftVertex and RightVertex are integer vertex labels, Content is the content of the edge (e.g., word(cat)) and Level is formatting information (not discussed here). Examples for items in the lexicon: category(the,det) category(kittens,cn) Examples for grammar rules: rule(s,[np,vp]) rule(np,[pn])

Cognitive Modeling: Language Processing – p.14

Input/Output Process

Rule 1: Add a word to the first position of the chart: TRIGGER word(W) IF not edge(_,_,_,_) is in Chart THEN add edge(0,1,word(W),0) to Chart Rule 2: Add a word to the next position of the chart: TRIGGER word(W) IF edge(N0,N1,word(W1),Y) is in Chart not edge(N1,N2,word(W2),Y) is in Chart N2 is N1 + 1 THEN add edge(N1,N2,word(W),Y) to Chart

Cognitive Modeling: Language Processing – p.15

Elaborate Chart Process

Rule 1: Lexical look-up: IF edge(N0,N1,word(W),L1) is in Chart category(W,C) is in Lexicon L is L1 + 1 THEN add edge(N0,N1,cat(C),L) to Chart Rule 2: Apply unary grammar rules: IF edge(N0,N1,cat(C1),L1) is in Chart rule(C,[C1]) is in Grammar Rules L is L1 + 1 THEN add edge(N0,N1,cat(C),L) to Chart

Cognitive Modeling: Language Processing – p.16

slide-5
SLIDE 5

Elaborate Chart Process

Rule 3: Apply binary grammar rules: IF edge(N0,N1,cat(C1),L1) is in Chart edge(N1,N2,cat(C2),L2) is in Chart rule(C,[C1,C2]) is in Grammar Rules L is max(L1,L2) + 1 THEN add edge(N0,N2,cat(C),L) to Chart Similar rules for grammar rules with more than two categories.

Cognitive Modeling: Language Processing – p.17

Properties of the Model

Simple, but complete chart parser with the following properties:

bottom-up: parsing is driven by the addition of words to

the chart; chart is expended upwards from lexical to phrasal categories;

limited incrementality: when a new word appears, all

possible edges are added to the chart; then the system quiesces and waits for the next word;

parallelism: all chart edges are added at the same time

(default Cogent behavior); multiple analyses (ambiguities) are pursued. Note: this model only determines if a string is grammatical (licensed by the grammar); it does not build syntactic structures.

Cognitive Modeling: Language Processing – p.18

Left Corner Parsing

The bottom-up model is incremental only in a limited sense (each word is processed as it appears). Cognitively plausible incrementality: each word is integrated into the structure as it appears (no unconnected words). This can be achieved using left corner parsing. The chart of a left-corner parser contains active edges that represent incomplete constituents. Example: NP/CN is a constituent that lacks a CN in order to become an NP . Introduction of active edges: for a passive edge Y and a grammar rule X → Y Z, introduce the active edge X/Z into the chart, where Y and X/Z span the same part of the string.

Cognitive Modeling: Language Processing – p.19

Example of a Left Corner Chart

The kittens bite cn det tv np det cn dog the s s/cn s/np s/vp np/cn vp/np np/cn

Cognitive Modeling: Language Processing – p.20

slide-6
SLIDE 6

Serial Parsing

If parsing was fully parallel, all analyses of a sentence would be equally available; there would be no garden paths. In the literature, two types of models have been assumed:

ranked parallel: multiple structures are pursued in parallel;

they are ranked in order of preferences; garden paths

  • ccur if a low-ranked structure turns out to be correct;

serial: only one structure is pursued; if it turns out to be

incorrect, then a garden path occurs.

Cognitive Modeling: Language Processing – p.21

Serial Parsing

Serial left-corner parser with backtracking:

At each point of ambiguity, the parser has to chose one

structure;

if the structure turns out to be incorrect; the parser has to

backtrack;

at the last point of ambiguity, the incorrect structure is

disassembled, and another alternative is pursued instead.

Cognitive Modeling: Language Processing – p.22

A Serial Model of Left Corner Parsing

Computational requirements:

  • perator selection: each stage of processing, the parser

has to select what to do: elaborate the current structure, read the next word, backtrack;

dept-first search: pursue a structure as far as possible

before alternatives are considered; requires inhibition of some edges in the chart;

backtracking: previous states of the parser must be

recoverable if backtracking occurs; requires removing edges from the chart.

Cognitive Modeling: Language Processing – p.23

A Serial Model of Left Corner Parsing

Basic architecture:

Cognitive Modeling: Language Processing – p.24

slide-7
SLIDE 7

Propose Operators Process

This process can propose the following operators:

reading the next word: add_word; lexical lookup: add_edge; project up from completed categories to parent categories

(i.e., create active edge): add_edge;

merge active edge with following edge (i.e., create passive

edge): add_edge. For details see (Cooper, 2002, p. 307).

Cognitive Modeling: Language Processing – p.25

Apply Operator Process

Rule 1: Select operator with the highest evaluation: IF operator(Operator,value(Score)) is in Operators not operator(AnyOp,selected) is in Operators not operator(OtherOp,value(OtherScore)) is in Operators OtherScore is greater than Score THEN delete operator(Operator,value(Score)) from Operators add operator(Operator,selected) to Operators Rule 2: Apply the selected operator, remove all others: IF operator(Operator,selected) is in Operators THEN delete all operator(_,_) from Operators add operator(Operator,apply) to Operators

Cognitive Modeling: Language Processing – p.26

Apply Operator Process

Rule 3: Push unselected operators onto the stack (note: this rules fires in parallel with Rule 2): IF operator(Operator,selected) is in Operators Ops is the list of all operator(O,value(V)) such that

  • perator(O,value(V)) is in Operators

V is greater than 0 Ops is distinct from [] get_context(Context) THEN send push(Choices(Context,Ops)) to Choice Points Rule 4: Remove applied operators: IF operator(Operator,apply) is in Operators THEN delete operator(Operator,apply) from Operators

Cognitive Modeling: Language Processing – p.27

Apply Operator Process

Rule 5: Add a word to the next position in the chart: IF operator(add_word(W,apply)) is in Operators get_word_position_parameters(N0,N1) get_context(TS) THEN add edge(N0,N1,word(W),W,0,TS) to Chart Rule 6: Add an edge of the specified type to the chart IF operator(add_edge(N0,N1,C,S,L),apply) is in Operators get_context(TS) THEN add edge(N0,N1,cat(C),S,L,TS) to Chart Also required: rules for backtracking (Cooper, 2002, p. 307).

Cognitive Modeling: Language Processing – p.28

slide-8
SLIDE 8

Discussion of the Model

This model will parse garden path sentences such as the

horse raced past the barn fell;

extensive backtracking will occur for such sentences; only

possible if the stack size of the choice point stack is sufficient; Potential problems:

backtracking requires that parse failure is detected; this

requires that the parser knows where the sentence boundaries are;

  • perator evaluations are fixed; context or experience is not

taken into accounts; no attempt to minimize backtracking.

Cognitive Modeling: Language Processing – p.29

Summary

The human parser builds syntactic structure in response

to strings of words;

parsing models have to capture the incrementality of

human parsing and account for ambiguity resolution (garden paths);

parsing models can be implemented in Cogent using a

chart (representing partial syntactic structure);

parallel parsing based on Cogent’s default behavior; left-corner parsing to achieve full incrementality;

  • perator selection to model serial parsing and

backtracking.

Cognitive Modeling: Language Processing – p.30

References

Cooper, Richard P. 2002. Modelling High-Level Cognitive Processes. Mahwah, NJ: Lawrence Erlbaum Associates.

Cognitive Modeling: Language Processing – p.31