This isnt exactly cheap but it is scalable if we assume hierarchical contexts.
['is']
['This', 'isnt', 'exactly', 'cheap', 'but', 'it', 'is', 'scalable', 'if', 'we', 'assume', 'hierarchical', 'contexts.']