Icon

Challenge 38 - Word Windows - Solution

You are a researcher concered with word usage and you would like to see how a target word is being used. To do this, you would like a method to extract 3 words before your target and 3 words after your target word if applicable (some target words are not preceeded by other words for instance).

In this challenge, you will be given various input which contains common traps for these kinds of searches such as line breaks, capitilization issues, punctuation, and no preceeding or following words. Our solution retains capitalization, is case insensitive, and captures multiple instances of the word depending on the window size. Please ignore misspellings.

Example input & output where "eggs" is the target:
Eggs are great. -> Eggs are great
I like eggz. -> ? (empty since no exact match)
I really do like eggs that (line break)
are covered in ketchup. -> really do like eggs that are covered (line can be retained if preferred)
I love eggs, but they need salt. -> I love eggs, but they need
Is KNIME secretly in love with EGGS??? -> in love with EGGS

Bonus: Make a component so others can play with your creation!

Nodes

Extensions

Links