Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Create TTS Web App With SSML Parsing

HardPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Create TTS Web App With SSML Parsing. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

Create a TTS web app with indications for the current reading sentence and the ability to highlight the currently playing word by fetching SSML content from an API and parsing the <s> elements into sentences without using DOMParser or external libraries.

Asked in the Take-home Assessment stage. 1 hour 30 minutes time limit. Implement fetchContent, parseContentIntoSentences, a useSpeech hook, and UI controls for playback and displaying the currently read sentence and word.

Input

  • ssml: a string containing SSML with one or more <s> elements

Output

  • A list of sentence strings extracted from the <s> elements, in order
  • Playback state that identifies the current sentence and current word while speech is active

Constraints

  • 1 <= len(ssml) <= 10^5
  • The input contains zero or more <s>...</s> blocks
  • Sentence text may include spaces and punctuation
  • No DOMParser or external parsing libraries are allowed

Function Signature

def parse_content_into_sentences(ssml):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output