Question: Code Exercise 2: extract_artists (2 points) Complete the function extract_artists(artist) so that it applies the artist name-separation algorithm described above, returning a Python set colisisting
Code Exercise 2: extract_artists (2 points) Complete the function extract_artists(artist) so that it applies the artist name-separation algorithm described above, returning a Python set colisisting of the separate artist names. For example: Alicia Keys ft. Jay-Z' -> 'jay ', 'alicia keys A-Trak x Kanye K Jay-Z -> (a trak', 'Jay z, "kanye) JAY Z Featuring Beyonce' -> '1ay z', 'beyonc) Jay-Z Featuring Beyonce Knowles -> (beyonce Knowles', day 2') Jay-Z/Kanye West/11 Wayne/T.1. -=> {'111 wayne', 'layit i'. kanye west) 'Young Jeezy Ft. Jay-Z & Fat Joe! ) ('fat Joey ' young Jeezy) Lil Wayne Drake Jay-Z And Gif Major --> Ceif major 11 wayne drake day Timbaland & Magoo feat Jay-Z' -> 'jay', 'timbalando Outkast/Jay-Z/Killer Mike' > ('outkast Jay killer nike Jay-Z Ft. Rihanna And Kanye West -> {'rihanna ay kanye west) Pat Benetar vs. Beyonce vs. 30H13 Feat. Britney Spears, Christina Aguilera, & MLA (' na', 'beyonce', 'christin a aguilera', 'nat benetar, britney spears', 303 day with the roots w ('jay ?', 'the roots' Note : Pay close attention to the target output Note 1 This procedure is imperfect. For example, observe that lil wayne Drake Jay-Z And Gif Majorzis, in reality, four artist (ur Wayne, Drake, Jay Z, and Gif Majorz), but the algorithm cannot dinambiguate the intention of spaces. Also, in the last example, even though in reality 'the roots. s should resolve to the roots, it instead becomes the roots And a band like 'Tom Petty and the Heartbreakers will be erroneously split into two artists (Tom Petty' and 'the Heartbreakers'). But it is what it is. In [158]: def extract artists(artist): M ### YOUR COOE HERE File "cipython-input-158-8aaa8e234ebf", line 4 SyntaxError: unexpected EOF while parsing Code Exercise 2: extract_artists (2 points) Complete the function extract_artists(artist) so that it applies the artist name-separation algorithm described above, returning a Python set colisisting of the separate artist names. For example: Alicia Keys ft. Jay-Z' -> 'jay ', 'alicia keys A-Trak x Kanye K Jay-Z -> (a trak', 'Jay z, "kanye) JAY Z Featuring Beyonce' -> '1ay z', 'beyonc) Jay-Z Featuring Beyonce Knowles -> (beyonce Knowles', day 2') Jay-Z/Kanye West/11 Wayne/T.1. -=> {'111 wayne', 'layit i'. kanye west) 'Young Jeezy Ft. Jay-Z & Fat Joe! ) ('fat Joey ' young Jeezy) Lil Wayne Drake Jay-Z And Gif Major --> Ceif major 11 wayne drake day Timbaland & Magoo feat Jay-Z' -> 'jay', 'timbalando Outkast/Jay-Z/Killer Mike' > ('outkast Jay killer nike Jay-Z Ft. Rihanna And Kanye West -> {'rihanna ay kanye west) Pat Benetar vs. Beyonce vs. 30H13 Feat. Britney Spears, Christina Aguilera, & MLA (' na', 'beyonce', 'christin a aguilera', 'nat benetar, britney spears', 303 day with the roots w ('jay ?', 'the roots' Note : Pay close attention to the target output Note 1 This procedure is imperfect. For example, observe that lil wayne Drake Jay-Z And Gif Majorzis, in reality, four artist (ur Wayne, Drake, Jay Z, and Gif Majorz), but the algorithm cannot dinambiguate the intention of spaces. Also, in the last example, even though in reality 'the roots. s should resolve to the roots, it instead becomes the roots And a band like 'Tom Petty and the Heartbreakers will be erroneously split into two artists (Tom Petty' and 'the Heartbreakers'). But it is what it is. In [158]: def extract artists(artist): M ### YOUR COOE HERE File "cipython-input-158-8aaa8e234ebf", line 4 SyntaxError: unexpected EOF while parsing
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
