Download presentation
Presentation is loading. Please wait.
1
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 16: 10/23
2
Midterm graded and returned +1 scaling applied –Final will be on material covered after midterm only –There will be one or two graded homeworks as well to come
3
Question 6 [Correction to lecture 15 slides] Give the deterministic FSA corresponding to:
4
Answer 6 [Correction to lecture 15 slides] Deterministic machine 1 5 2 a 3 c 4 c a b b c 6 a
5
Recap Following Chapter 3 of the textbook
6
Stage 1: Lexical Intermediate Levels Figure 3.17 (top half): tape view of input/output pairs
7
The Mapping Problem Example: (3.11) (Context-Sensitive) Spelling Rule: (3.5) – e / { x, s, z } ^ __ s# rewrites to letter e in left context x^ or s^ or z^ and right context s# i.e. insert e after the ^ when you see x^s# or s^s# or z^s# in particular, we have x^s# x^es#
8
Stage 2: Intermediate Surface Levels also can be implemented using a FST important! machine is designed to pass input not matching the rule through unmodified (rather than fail) implements context-sensitive rule q 0 to q 2 : left context q 3 to q 0 : right context
9
Stage 2: Intermediate Surface Levels Example (3.17)
10
Stage 2: Intermediate Surface Levels Transition table for FST in 3.14 pg.79
11
Stage 2: Intermediate Surface Levels Class Exercise –Let’s build this FST in Prolog together –state by state
12
Stage 2: Intermediate Surface Levels A Note on Prolog –it will be useful to employ the cut predicate for the implementation of “other” ! is known as the “cut” predicate –it affects how Prolog backtracks for another solution –it means “cut” the backtracking off –Prolog will not try any other possible matching rule on backtracking
13
FST 3.14 in Prolog % To run: ?- q0([f,o,x,^,s,#],L). L = [f,o,x,e,s,#] % q0 q0([],[]).% final state case q0([z|L1],[z|L2]) :- !, q1(L1,L2). % q0 - z -> q1 q0([s|L1],[s|L2]) :- !, q1(L1,L2). % q0 - s -> q1 q0([x|L1],[x|L2]) :- !, q1(L1,L2). % q0 - x -> q1 q0([#|L1],[#|L2]) :- !, q0(L1,L2). % q0 - # -> q0 q0([^|L1],L2) :- !, q0(L1,L2). % q0 - ^:ep -> q0 q0([X|L1],[X|L2]) :- q0(L1,L2). % q0 - other -> q0
14
FST 3.14 in Prolog % q1 q1([],[]).% final state case q1([z|L1],[z|L2]) :- !, q1(L1,L2). % q1 - z -> q1 q1([s|L1],[s|L2]) :- !, q1(L1,L2). % q1 - s -> q1 q1([x|L1],[x|L2]) :- !, q1(L1,L2). % q1 - x -> q1 q1([^|L1],L2) :- !, q2(L1,L2). % q1 - ^:ep -> q2 q1([#|L1],[#|L2]) :- !, q0(L1,L2). % q1 - # -> q0 q1([X|L1],[X|L2]) :- q0(L1,L2). % q1 - other -> q0
15
FST 3.14 in Prolog % q2 q2([],[]).% final state case q2(L1,[e|L2]) :- q3(L1,L2). % q2 - ep:e -> q3 q2([s|L1],[s|L2]) :- !, q5(L1,L2). % q2 - s -> q5 q2([z|L1],[z|L2]) :- !, q1(L1,L2). % q2 - z -> q1 q2([x|L1],[x|L2]) :- !, q1(L1,L2). % q2 - x -> q1 q2([#|L1],[#|L2]) :- !, q0(L1,L2). % q2 - # -> q0 q2([X|L1],[X|L2]) :- \+ X = ^, q0(L1,L2). % q2 - other - > q0
16
FST 3.14 in Prolog % q3 q3([s|L1],[s|L2]) :- q4(L1,L2). % q3 - s -> q4 % q4 q4([#|L1],[#|L2]) :- q0(L1,L2). % q4 - # -> q0
17
FST 3.14 in Prolog % q5 q5([z|L1],[z|L2]) :- !, q1(L1,L2). % q5 - z -> q1 q5([s|L1],[s|L2]) :- !, q1(L1,L2). % q5 - s -> q1 q5([x|L1],[x|L2]) :- !, q1(L1,L2). % q5 - x -> q1 q5([^|L1],L2) :- !, q2(L1,L2). % q5 - ^:e -> q2 q5([X|L1],[X|L2]) :- \+ X = #, q0(L1,L2). % q5 - other -> q0
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.