Professional Documents
Culture Documents
A. [1 POINT] The set of all lower-case alphabetic strings ending in the letter b.
[a-z]*b
Question 2: [1 point]
Write regular expressions for the following languages. By “word”, we mean an alphabetic
string separated from other words by whitespace, any relevant punctuation, line breaks,
and so forth. You may use regexpal tool for testing.
A. [1 POINT] All strings that start at the beginning of the line with an integer and that
end at the end of the line with a word.
^\d+b.*\b[a-zA-Z] +$
© 2019-2020 Faculty of Information Technology (FIT), Applied Science Private University, Amman, Jordan. 1
Question 3: [3 points]
Compute the edit distance (using insertion cost 1, deletion cost 1, substitution cost 1) of
“leda” to “deal”. Show your work (using the edit distance grid).
Target
l a e d #
Source
4 3 2 1 0 #
3 3 2 1 1 l
1 2 1 2 2 e
1 2 1 2 3 d
0 1 1 3 4 a
© 2019-2020 Faculty of Information Technology (FIT), Applied Science Private University, Amman, Jordan. 2
Question 4: [5 points]
Use the algorithm of minimum edit distance with backtrace to output the alignment to
convert "beauty" to "buy" with minimum edit distance. Show your work (using the
minimum edit distance with backtrace grid).
Target
y u b #
Source
<3 <2 <1 0 #
2 1 \0 ^1 b
2 2 1 ^2 e
3 3 2 ^3 a
4 3 3 ^4 u
5 4 4 ^5 t
5 5 5 ^6 y
GOOD LUCK
© 2019-2020 Faculty of Information Technology (FIT), Applied Science Private University, Amman, Jordan. 3