Computational Linguistics II: Parsing CSGs, Turing Machines, LBAs - - PowerPoint PPT Presentation

computational linguistics ii parsing
SMART_READER_LITE
LIVE PREVIEW

Computational Linguistics II: Parsing CSGs, Turing Machines, LBAs - - PowerPoint PPT Presentation

Computational Linguistics II: Parsing CSGs, Turing Machines, LBAs Outlook: Other Grammar Formalisms Frank Richter & Jan-Philipp S ohn fr@sfs.uni-tuebingen.de, jp.soehn@uni-tuebingen.de Computational Linguistics II: Parsing p.1 The


slide-1
SLIDE 1

Computational Linguistics II: Parsing

CSGs, Turing Machines, LBAs Outlook: Other Grammar Formalisms

Frank Richter & Jan-Philipp S¨

  • hn

fr@sfs.uni-tuebingen.de, jp.soehn@uni-tuebingen.de

Computational Linguistics II: Parsing – p.1

slide-2
SLIDE 2

The Big Picture

hierarchy grammar machine

  • ther

type 3

  • reg. grammar

D/NFA

  • reg. expressions
  • det. cf.

LR(k) grammar DPDA type 2 CFG PDA type 1 CSG LBA type 0 unrestricted Turing grammar machine

Computational Linguistics II: Parsing – p.2

slide-3
SLIDE 3

Context Sensitive Grammars (1)

Definition

A grammar N, T, P, S is context-sensitive iff every production in P is of the form x1Ax2 → x1yx2, with

x1, x2 ∈ Σ∗, y ∈ Σ+, A ∈ N and the possible exception of C → ǫ in case C does not occur on the righthand side of a

rule in P.

Definition

A grammar N, T, P, S is monotonic iff for every production l → r ∈ P, |l| ≤ |r|.

Computational Linguistics II: Parsing – p.3

slide-4
SLIDE 4

Context Sensitive Grammars (2)

We will not prove the following important theorem:

Theorem

(I) For every monotonic grammar GM there is a context-sensitive grammar GS such that L(GM) = L(GS). (II) For every context-sensitive grammar GS there is a monotonic grammar GM such that L(GS) = L(GM). Remark: The languages generated by monotonic and context-sensitive grammars are generally referred to as context-sensitive languages. Their grammars are called Type 1 grammars.

Computational Linguistics II: Parsing – p.4

slide-5
SLIDE 5

Kuroda Normal Form (1)

A Type 1 grammar N, T, P, S is in Kuroda Normal Form iff all productions in P are of one of the following forms:

  • 1. A → a
  • 2. A → B
  • 3. A → BC
  • 4. AB → CD.

(A, B and C in N, a in T)

Computational Linguistics II: Parsing – p.5

slide-6
SLIDE 6

Kuroda Normal Form (2)

Theorem

For every Type 1 grammar G with ǫ ∈ L(G) there is a grammar G′ in Kuroda Normal Form such that L(G) = L(G′).

Computational Linguistics II: Parsing – p.6

slide-7
SLIDE 7

Turing Machine

Definition

A septuple M = (Q, Σ, Γ, δ, q0, , F) is a Turing Machine iff

Computational Linguistics II: Parsing – p.7

slide-8
SLIDE 8

Turing Machine

Definition

A septuple M = (Q, Σ, Γ, δ, q0, , F) is a Turing Machine iff

Q is a finite set (the set of states),

Computational Linguistics II: Parsing – p.7

slide-9
SLIDE 9

Turing Machine

Definition

A septuple M = (Q, Σ, Γ, δ, q0, , F) is a Turing Machine iff

Q is a finite set (the set of states), Σ is a finite set (the input alphabet),

Computational Linguistics II: Parsing – p.7

slide-10
SLIDE 10

Turing Machine

Definition

A septuple M = (Q, Σ, Γ, δ, q0, , F) is a Turing Machine iff

Q is a finite set (the set of states), Σ is a finite set (the input alphabet), Γ is a finite set, Σ ⊂ Γ (the set of tape symbols),

Computational Linguistics II: Parsing – p.7

slide-11
SLIDE 11

Turing Machine

Definition

A septuple M = (Q, Σ, Γ, δ, q0, , F) is a Turing Machine iff

Q is a finite set (the set of states), Σ is a finite set (the input alphabet), Γ is a finite set, Σ ⊂ Γ (the set of tape symbols), δ is a function from Q × Γ to Q × Γ × {L, R, S} (the next

move function),

Computational Linguistics II: Parsing – p.7

slide-12
SLIDE 12

Turing Machine

Definition

A septuple M = (Q, Σ, Γ, δ, q0, , F) is a Turing Machine iff

Q is a finite set (the set of states), Σ is a finite set (the input alphabet), Γ is a finite set, Σ ⊂ Γ (the set of tape symbols), δ is a function from Q × Γ to Q × Γ × {L, R, S} (the next

move function),

q0 ∈ Q (the start state),

Computational Linguistics II: Parsing – p.7

slide-13
SLIDE 13

Turing Machine

Definition

A septuple M = (Q, Σ, Γ, δ, q0, , F) is a Turing Machine iff

Q is a finite set (the set of states), Σ is a finite set (the input alphabet), Γ is a finite set, Σ ⊂ Γ (the set of tape symbols), δ is a function from Q × Γ to Q × Γ × {L, R, S} (the next

move function),

q0 ∈ Q (the start state), ∈ (Γ − Σ) (the blank), and

Computational Linguistics II: Parsing – p.7

slide-14
SLIDE 14

Turing Machine

Definition

A septuple M = (Q, Σ, Γ, δ, q0, , F) is a Turing Machine iff

Q is a finite set (the set of states), Σ is a finite set (the input alphabet), Γ is a finite set, Σ ⊂ Γ (the set of tape symbols), δ is a function from Q × Γ to Q × Γ × {L, R, S} (the next

move function),

q0 ∈ Q (the start state), ∈ (Γ − Σ) (the blank), and F ⊆ Q (the set of final states).

Computational Linguistics II: Parsing – p.7

slide-15
SLIDE 15

Configuration of a Turing Machine

Definition

A configuration of a Turing Machine M = (Q, Σ, Γ, δ, q0, , F) is a word w ∈ Γ∗QΓ∗.

Computational Linguistics II: Parsing – p.8

slide-16
SLIDE 16

Move of a Turing Machine

We define the moves, ⊢ of a Turing machine from one configuration to the next:

Definition

a1 . . . amqb1 . . . bn ⊢                                      a1 . . . amq′cb2 . . . bn, δ(q, b1) = (q′, c, S), m ≥ 0, n ≥ 1 a1 . . . amcq′b2 . . . bn, δ(q, b1) = (q′, c, R), m ≥ 0, n ≥ 2 a1 . . . am−1q′amcb2 . . . bn, δ(q, b1) = (q′, c, L), m ≥ 1, n ≥ 1 a1 . . . amcq′, δ(q, b1) = (q′, c, R), m ≥ 0, n = 1 q′cb2 . . . bn, δ(q, b1) = (q′, c, L), m = 0, n ≥ 1

Computational Linguistics II: Parsing – p.9

slide-17
SLIDE 17

Language Accepted by a TM

Definition

The language L(M) accepted by a Turing machine

M = (Q, Σ, Γ, δ, q0, , F) is L(M) = {x ∈ Σ∗|q0x ⊢∗ αqβ; α, β ∈ Γ∗; q ∈ F}.

Computational Linguistics II: Parsing – p.10

slide-18
SLIDE 18

Linear Bounded Automata

A linear bounded automaton is a nondeterministic Turing machine satisfying the following conditions:

  • 1. Its input alphabet includes two special symbols, the left

and right endmarkers.

  • 2. The LBA has no moves left from the left endmarker or

right from the right endmarker, nor may it print another symbol over them.

Computational Linguistics II: Parsing – p.11

slide-19
SLIDE 19

Linear Bounded Automata

A linear bounded automaton is a nondeterministic Turing machine satisfying the following conditions:

  • 1. Its input alphabet includes two special symbols, the left

and right endmarkers.

  • 2. The LBA has no moves left from the left endmarker or

right from the right endmarker, nor may it print another symbol over them.

Theorem

The languages accepted by LBAs are exactly the languages generated by CSGs.

Computational Linguistics II: Parsing – p.11

slide-20
SLIDE 20

German VPs (simplified)

der Arzt gibt dem Patienten die Pille der Arzt gibt die Pille dem Patienten dem Patienten gibt der Arzt die Pille dem Patienten gibt die Pille der Arzt die Pille gibt der Arzt dem Patienten die Pille gibt dem Patienten der Arzt der Arzt gibt ihm die Pille die Pille gibt ihm der Arzt dem Patienten gibt sie der Arzt die Pille gibt er ihm der Arzt gibt sie ihm dem Patienten gibt er sie der Arzt sagt dem Patienten daß er krank ist dem Patienten sagt der Arzt daß er krank ist

Computational Linguistics II: Parsing – p.12

slide-21
SLIDE 21

CF Production Rules for German VPs

V P → V NPdat NPakk V P → V NPakk NPdat V P → V NPnom NPakk V P → V NPakk NPnom V P → V NPnom NPdat V P → V NPdat NPnom V P → V NPPdat NPakk V P → V NPPdat NPnom V P → V NPPakk NPnom V P → V NPPnom NPPdat V P → V NPPakk NPPdat V P → V NPPnom NPPakk V P → V NPdat S V P → V NPnom S

Computational Linguistics II: Parsing – p.13

slide-22
SLIDE 22

Generalizations

simple definite NPs come in no particular order pronominal NPs precede definite NPs pronominal nominative subjects precede dative objects pronominal nominative subjects precede accusative

  • bjects

pronominal accusative objects precede pronominal dative objects definite NPs precede sentential objects

Computational Linguistics II: Parsing – p.14

slide-23
SLIDE 23

ID/LP Grammars

distinguish two different types of information in phrase structure rules: immediate dominance (ID) and linear precedence (LP) idea: split ID information from LP information ID rules only determine the number of daughters and their syntactic category LP rules determine the sequence of nodes in local trees ID rule: V P → V, NPakk, NPdat LP rule: NPPnom ≺ NPPdat LP rules apply globally

Computational Linguistics II: Parsing – p.15

slide-24
SLIDE 24

ID/LP: An Example

ID rule: V P → V, NPakk, NPdat possible trees:

VP V NPakk NPdat VP V NPdat NPakk VP NPakk V NPdat VP NPakk NPdat V VP NPdat V NPakk VP NPdat NPakk V

Computational Linguistics II: Parsing – p.16

slide-25
SLIDE 25

The German VP Revisited

V P → V NPdat NPakk V P → V NPakk NPdat V P → V NPnom NPakk V P → V NPakk NPnom V P → V NPnom NPdat V P → V NPdat NPnom V P → V NPPdat NPakk V P → V NPPdat NPnom V P → V NPPakk NPnom V P → V NPPnom NPPdat V P → V NPPakk NPPdat V P → V NPPnom NPPakk V P → V NPdat S V P → V NPnom S

Computational Linguistics II: Parsing – p.17

slide-26
SLIDE 26

The German VP Revisited

V P → V NPdat NPakk V P → V, NPdat, NPakk V P → V NPakk NPdat V P → V, NPnom, NPakk V P → V NPnom NPakk V P → V, NPnom, NPdat V P → V NPakk NPnom V P → V, NPPdat, NPnom V P → V NPnom NPdat V P → V, NPPakk, NPnom V P → V NPdat NPnom V P → V, NPPakk, NPPnom V P → V NPPdat NPakk ⇒ V P → V, NPPdat, NPPnom V P → V NPPdat NPnom V P → V, NPPakk, NPPdat V P → V NPPakk NPnom V P → V, NPPdat, S V P → V NPPnom NPPdat V P → V, NPPakk, S V P → V NPPakk NPPdat NPPnom ≺ NPPakk ≺ NPPdat V P → V NPPnom NPPakk ≺ NPnom/akk V P → V NPdat S NPnom/dat ≺ S, V ≺ XP V P → V NPnom S

Computational Linguistics II: Parsing – p.17

slide-27
SLIDE 27

Equivalence of Grammars

two grammars are weakly equivalent iff they describe the same language two grammars are strongly equivalent iff they are weakly equivalent and assign the same structure(s) to each sentence for each ID/LP grammar, there is a strongly equivalent CFG for each CFG, there is a weakly equivalent ID/LP grammar there are CFGs with a strongly equivalent ID/LP grammar; these grammars possess the ECPO property ECPO = exhaustive constant partial ordering

Computational Linguistics II: Parsing – p.18

slide-28
SLIDE 28

A non-ECPO Grammar

CFG:

SV 2 → NP Vfin NP Vpp SV end → KON NP NP Vpp Vfin

a weakly equivalent ID/LP grammar:

SV 2 → NPK, V X1, NPY , Vpp, SV end → KON, NP, NP, Vpp, V X2, V X1 → Vfin, NPK → NP, V X2 → Vfin, NPY → NP, V X1 ≺ Vpp, NPK ≺ V X1, KON ≺ NP ≺ Vpp Vpp ≺ V X2, V X1 ≺ NPY

Computational Linguistics II: Parsing – p.19