LINGC SCPSYC 438538 Computational Linguistics - PowerPoint PPT Presentation

1 / 18
About This Presentation
Title:

LINGC SCPSYC 438538 Computational Linguistics

Description:

Let's define Ei to be the possible strings that can lead to an accepting ... Class Exercise. Let = {a,b} Give a Perl regexp equivalent to the complement regexp ... – PowerPoint PPT presentation

Number of Views:38
Avg rating:3.0/5.0
Slides: 19
Provided by: sandiw
Category:

less

Transcript and Presenter's Notes

Title: LINGC SCPSYC 438538 Computational Linguistics


1
LING/C SC/PSYC 438/538Computational Linguistics
  • Sandiway Fong
  • Lecture 13 10/9

2
Administrivia
  • Homework 2
  • grade (to be) sent by email today
  • Upcoming midterm
  • this Thursday

3
NDFSA ? (D)FSA Recap
  • set of states construction
  • new machine simulates in parallel all possible
    situations for the original machine
  • procedure must terminate
  • 4 states
  • 24-115 possible different states in the new
    machine

4
Practice Question
  • convert the NDFSA into a deterministic FSA
  • implement both the NDFSA and the equivalent FSA
    in Prolog using the one predicate per state
    encoding
  • run both machines on the strings abab and abaaba,
  • how many steps (transitions final stop) does
    each machine make?

from figure 2.27 in the textbook
5
Todays Topics
  • FSA to regexp
  • FSA and complementation
  • Regexp and complementation

6
FSA to Regexp
  • Give a Perl regexp for this FSA

7
FSA to Regexp
  • Lets define Ei to be the possible strings that
    can lead to an accepting computation from state i
  • Then
  • E1 aE2
  • E2 bE3 bE4
  • E3 aE2 ?
  • E4 aE3

8
FSA to Regexp
  • Solve simultaneous equations
  • E1 aE2
  • E2 bE3 bE4
  • E3 aE2 ?
  • E4 aE3

9
FSA to Regexp
  • Solve simultaneous equations
  • E1 aE2
  • E2 bE3 bE4 (eliminate)
  • E3 aE2 ?
  • E4 aE3
  • Then
  • E1 abE3 abE4
  • E3 abE3 abE4 ?

10
FSA to Regexp
  • Solve reduced equations
  • E1 abE3 abE4
  • E3 abE3 abE4 ?
  • E4 aE3

11
FSA to Regexp
  • Solve reduced equations
  • E1 abE3 abE4
  • E3 abE3 abE4 ?
  • E4 aE3 (eliminate E4)
  • Then
  • E1 abE3 abaE3
  • E3 abE3 abaE3 ?

12
FSA to Regexp
  • Solve reduced equations
  • E1 abE3 abaE3
  • E3 abE3 abaE3 ?
  • Solve recursive definition for E3
  • rewrite E3 as
  • E3 (ababa)E3 ?

13
FSA to Regexp
  • Then
  • E1 abE3 abaE3
  • E3 (ababa)
  • Also
  • E1 (ababa)E3
  • Substituting for E3
  • E1 (ababa)(ababa)

14
FSA to Regexp
  • E1 (ababa)(ababa)
  • We know
  • e ee ee
  • Hence
  • E1 (ababa)

Note the order of variable elimination matters
15
FSA and Complementation
  • FSA are closed under complementation
  • i.e. make a new FSA accept strings rejected by
    FSA, and reject strings accepted by FSA over the
    alphabet
  • ? a,b

16
FSA and Complementation
  • A Simple Idea
  • make old accepting state(s) non-final states
  • make non-final and reject states accepting states
  • Nearly correct, but why does this not work?
  • hint consider aba

3
1
2
4
5
17
FSA and Complementation
  • Prolog
  • one(aL) - two(L).
  • two(bL) - three(L).
  • two(bL) - four(L).
  • three().
  • three(aL) - two(L).
  • four(aL) - three(L).
  • To construct the complement FSA in Prolog
  • add a single line
  • fsab(L) - \ one(L).
  • \ is the Prolog operator for negation as failure
    to prove
  • i.e.
  • \ one(L) is true if one(L) cannot be true
  • \ one(L) is false if one(L) can be true

weakness is that \ cant be used to generate
18
Regexps and Complementation
  • Not part of basic regexps
  • Formally, we can define
  • complement of regexp e ? e
  • where
  • ? set of all possible strings over alphabet ?
  • i.e. zero or more occurrences ...
  • Class Exercise
  • Let ? a,b
  • Give a Perl regexp equivalent to the complement
    regexp for (ababa)
Write a Comment
User Comments (0)
About PowerShow.com