Académique Documents
Professionnel Documents
Culture Documents
Page 1 of 4
10. Given that the set of terminals is {x, y} and A is nonterminal, which of the following words is
correctly generated from the CFG: Ax| yA
a. xyyy c. yxyxy
b. yyyx d. xyy
Question 2: (5 Marks)
1. Give regular expression to express each of the following:
a. The set of all lower case alphabetic strings ending in letters ing.
Answer:
Algebraic Notation
(a+b++z)* ing
Perl Notation
[a-z] [a-z]*ing
b. The set of all upper case alphabetic strings with letter a as a third letter.
Answer:
Algebraic Notation
(A+B++Z) (A+B++Z) a (A+B++Z)*
Perl Notation
[A-Z] [A-Z] a [A-Z]*
c. The set {can, car, cat}
Answer:
Algebraic Notation
ca(n+r+t) or can+car+cat
Perl Notation
ca[n r t] or ca(n| r| t)
2. Define finite state transducers (FST), then design a FST that takes the lexical form:
box +N +PL
and produces the intermediate form box ^s#
Answer:
A finite state transducer (FST) is a type of finite automaton, it accepts input and produces output, if
consists formally from the following:
Page 3 of 4
S
NP VP
ProperNoun VP PP
Maged Town
3. What is the highest probability for any parse tree of this sentence under this Probabilistic CFG?
Answer: (2 Marks)
1* 0.5 * .9 * 0.2 *0.1 *1.0 *1.0 *.5 *1.0 *.5 *.2 *0.6 = 0.0027
NP VP
ProperNoun Verb NP
Adel saw NP PP
ProperNoun Preposition NP
Maged in ProperNoun
Town
The probability of this tree is: 1 * 0.5 * 0.2 *.1 * 1.0 * 0.5 * 0.5 *0.2 *1.0 *1.0 *.5 *.6 = 0.00015
The first parse tree is of the highest probability.
Page 4 of 4