Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 1 Regular Expressions [12] |(a) Provide a regular expression that can be used to find email addresses in a text file. (5) An email
Question 1 Regular Expressions [12] |(a) Provide a regular expression that can be used to find email addresses in a text file. (5) An email address for our purposes) has the following: An initial string of alphanumeric characters, including the special characters +, - (un- derscore), and. (period). The initial string may not start or end with any of the special characters. The initial string will always have a length of at least two. The initial string is followed by the '@' symbol, the '@' symbol is followed by one or more domain strings which consists of any al- phanumeric characters. Domain strings are separated with a . (period). Domain strings must have a length of at least five. (b) Given your regular expression, provide an example of a string that may be matched but that would not be considered a true email address. Explain why the string is matched. (2), (c) As humans, we often try to thwart email scanners using regular expressions. Provide an example of an email address written in such a way that it can be recognised by a felow human, but which a regular expression such as the one above will not catch. Clearly explain why the string will be interpreted as an email address by a human, but not by a scanner using the regular expression descrbed above. (d) Suppose we want to write a simplistic grammar checker. One of our tasks is to find repetitive words in sentences. 1. What mechanism in regular expressions wil allow us to detect a repeated sub-string of characters? (1) ii. Provide the regular expression to detect such repetitions. You may assume that the sentences we are checking contain only words which consist of alphanumeric charac ters. Question 2 Morphological Parsing [9] (a) Clearly explain what morphological parsing is. (3) (b) Provide a morphological rule for any English word of your choice which ilustrates the dificulty one may encounter in morphological parsing. (2) (c) It is easy to imagine that one can simply create a rule-set which stores these morpholog- ical rules for each word. Explain why this may be an inefficient approach Discuss the mechanism that can solve this problem, and show how it may work (you may present a diagram that represents a concrete example of a morphological rule). (4) (2) (2)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started