Your question is Streaming Tokenization Under Tight Memory. 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.
Write a function to process and tokenize streaming text data under tight memory constraints.
Implement tokenize_stream(chunks), where chunks is an iterable of strings. Return a list of tokens in order, splitting on any whitespace character. Chunks may split a token, and a token may continue across empty chunks. Process the input incrementally rather than concatenating all chunks first.
str.isspace() to identify delimiters.chunks is an iterable of stringsstr.isspace()def tokenize_stream(chunks):