Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is matlab question. Plz don't use 'find' Input: - (1 xN char) A vector of chars representing the testimony of a withess. - (1

This is matlab question. Plz don't use 'find'

image text in transcribed

Input: - (1 xN char) A vector of chars representing the testimony of a withess. - (1 116 char) A vector of chars containing 4 three letter words, each followed by spaces. These are the keywords that the jurors are looking for in the testimony. Output: - (1 N double) A vector of chars representing the redacted version of the testimony where each keyword is replaced by three capital X's. - (1x12 logical A vector of logicals representing the vote af each juror. (true for guilty, false for not guilty) - (logical) True if the defendant is guilty, false if they are not guilty. Function Description: You are given a string representing the testimeny of a witness. You are also given a vector containing four three letter keywords (each followed by a space). You are to write a function that searches the first string for the keywords and calculates the wote of each of the 12 jurors by using the algorithm liated below. If more than half of the jurors vote guily, then the defendant is found guilty. Otherwise, the defendant is found not guilty. - Each juror has a vote of not guilty (logical 0 ) before the testimony is given. - If the first keyword occurs more than three times, jurors 1, 5, and 11 vote guilty (logical 1). - If the second keyword occurs less than four times, jurors 4, 6 , and 8 vote guilty (logical 1). - If the second keyword occurs more than the third keyword, jurors 2, 3, and 7 vote guilty (logical 1). - If all occurances of the fourth keyword are in the first half of the testimony, jurors 10,9 , and 12 vote guilty (logical 1). Your first output is a copy of the first input with the occurance of each keyowrd replaced by three X 's. The second output is a 112 vector of logicals representing the vote of each juror itrue for guilty, false for not guily) as calculated by the criteria listed above. The thirct culput is true if the deferidant is found guilty and false if they were found not guilty. Note(5): - To occur in the first half of the testimony, the word must start before the ceil(lengthin/2) character of the testimony. - Each keyword is guaranteed to cccur at least once in the testimony - A keyword may be contained within another word - The case of the keyword must match - The find function is banned Examples: testimony1 - ['You see your honor, umel what had happened was I was over at steves house to watch the game and have some fun' ... 'when out of nowhere canie a this turtle that ate all of the umm chips and unn cookies. The whole event was had a huge eftect on' ... "ny trust in steve to take care of his pets, but I do not blame steve beacuse I later found out that they where his roonates pets'... "who had left for the unn weekend" ]; keywords1 - 'umu but and had'; [redacted1, juryvotes1, guilty1] - verdict(testinony1, keywords1) %> redacted1 - 'You see your honor, xxx what Xxx happend was 1 was over at steves house to watch the game xxX have some furinhen out of nouwhere x juryvotes 1=[10011110010] (logical) guilly1 - (logeitial) "We ran into Booby who is Francines cousin and Al11ie who is my cousin, 50 we all decide to go to the mowies. That is when we 5 aw that actor "rule ot the villian in the tirst sequal to the second film. Anyway, when we all leokedd arcuurd we saar the cheterndarit who had cri a red hal, runt keywords2 = 'who the and all '; x> redacted2 = 'You see your honor, umm what happend was Francine xxx I went xxx mxx. They where having a sale on xxx of xxx towels xxx pillowc r guiltyz =0 (logical) testimony3 - ["I COULD NOT, hOULD NOT, ON A BOAT"... 'I WILL ROT, WILL ROT, WITH A GOAT'... ' I WILL NOT EMT IHEN IN THE RAIN'... ' NOT IN THE ORRKI ROT IN A TREEI'... ' NoT IN A CAR! YOU LET ME BE!'... 'I DO NOT LIKE THEN IN A BOX.... ' T DO NOT I TKR TIINN WTTII A FOX'... 'I WILL ROT EAT THEM IN A HCUSE'.... ' T DO NOT I TKL TIIN WTTII A MOUSE'... 'I DO NOT LIKE THEN HERE OR THERE' '. ' I DO NOT LTKE THEM ANWIIIRE!'... 'I DO NOT LIKE GREEN EGGS AND HAN!'... ' I DO NOT LIKE THEM, SAMM-I-AM.'I; keynords3 = 'AND SAM NOT EAT'; [redacted3, juryvates3, Euilty3]= verdict(testinany3, keywords3) % redacted3 = 'I COULD xXX, WOULD xXX, ON A BOATI WILL XXX, WILL XXX, WITH A GOATI WILL XXX XXX THEM IN THE RAINXXX IN THE DARK! XXX IN A TREE x guilty 3 - (logical)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

A _ _ _ _ is a query ( SELECT statement ) inside a query.

Answered: 1 week ago