Intervals search with complicated before/after requirements

I'm trying to develop a query that's based on several interval searches. One of the searches needs to exclude intervals containing a particular word if it appears in the interval, within the 10 preceding words before the interval, or the 10 words after.

The first is easy to handle with a not_contained_by filter. However, I can't think of how to formulate a query that works as a not_after or not_before query that searches over the specified range.

Any ideas?