write a regular expression in python (nltk) that will find strings using integers, additon, and multiplication, such as 5*5+8.
Regular expression:-
(\d+(*|/|+|-))+
Explanation:-
The above regular expression is used to perform one or more operations between the digits.
\d indicates the digit from 0-9 which is followed by the + .It means that the size of the number obtained by the digits from 0-9 can be 1 or more than 1.
(*|/|+|-) indicates the four arithmetic operations i.e, multiplication , division , addition , subtraction. It contain | symbol indicating the OR operation which mean that either of the 4 operations is chosen at a time.
+ (at the end) clearly indicates that one or more operations between one or more digits.
write a regular expression in python (nltk) that will find strings using integers, additon, and multiplication,...
6. [4 marks] Write a regular expression over the alphabet of numeric digits that matches strings formatted as integers between 33 and 526 (inclusive). For example, the following strings should be accepted: • 33 • 51 • 290 • 526 But the following strings should not be accepted: • 9 • 31 • 607 • 1000
Write a regular expression that captures the set of strings composed of 'a', 'b', and 'c', where any string uses at most two of the three letters (for example, "abbab" is a valid string, or "bccbb", or "ccacaa", but not "abccba": strings that contain only one of the three letters are also fine). Give a non-deterministic finite automaton that captures the regular expression from Using the construction described in class, give a deterministic version of the automaton. Repeat the previous...
Write a regular expression that matches: a) all strings that end with a dot character ".", without the quotes. b) all strings that begin with a "#" character, without the quotes. c) all floating-point numbers using standard notation (e.g., 12.345 or –12.345). Note that matching numbers may contain any number of digits before or after the decimal point. d) all floating-point numbers using scientific notation (e.g., 1.234e+5 or –1.234E–5). Again, matching numbers may contain any number of digits before or...
Multiplication of two numbers: Write a recursive program that multiplies two integers. As an input to your program perform multiplication of the largest 8-bit number (unsigned) with the largest 16-bit number (unsigned) [Programming, 10 Points]. Complete in python and show output
•Write a regular expression for both a zip code and a phone number in python.
Find a regular expression for the following language over the alphabet Σ = {a,b}. L = {strings that begin and end with a and contain bb}.
Use the Python “re” module to do the following: 1. Write a regular expression pattern that matches string “March 1, 2019, Mar 1, 2019, March First, 2019, March First, 19”. No credit for not using special characters: “*,+,?, | and etc” to do the matching. 2. Write a regular expression pattern that matches strings representing trains. A single letter stands for each kind of car in a train: Engine, Caboose, Boxcar, Passenger car, and Dining car. There are four rules...
Find all strings with length exactly 4 represented by the regular expression, a*bb*. Put your answers in alphabetical order separated by a single space and no commas.
Write a program using regular expression to find the starting and ending locations of ‘fox’ in the text 'The quick brown fox jumps over the lazy dog.' Then print out its locations as follows: Found fox from (the starting location) to (the ending location).
1. (30 Points) Write a MATLAB program that displays "The multiplication of 10 multiplied by integers of 1 through 15. Display your result back to the user with 2 decimal places (yes, 2 decimal places). You must implement your code using a for loop. The result should have the following format: The multiplication of 10*1 =10.00 The multiplication of 10*2 =20.00 The multiplication of 10'3=30.00 The multiplication of 10*15=150.00 2. (35 Points) Write MATLAB code to prompt a user for...