I have an array with thousands of items (each one is a word extracted from a document). I want to run some logic on the array, but the main goal is to focus on words that are only nearby to a key word. So, for example,
The quick brown FOX jumped over the lazy dog.
Let's say I want to focus on any word right next to "FOX" and ignore all other words. Currently, I run through the array one word at a time, and then have a sub-loop that tests the words right before and right after.
More precisely...
The problem is that with thousands of elements (and actually testing 5 words prior and 5 words after), the total iterations is a lot and takes too long currently.
Any suggestions? Basically I want to determine array elements are nearby to the key word ("fox") because ultimately I want to ignore all the other elements in a later loop.
The quick brown FOX jumped over the lazy dog.
Let's say I want to focus on any word right next to "FOX" and ignore all other words. Currently, I run through the array one word at a time, and then have a sub-loop that tests the words right before and right after.
More precisely...
Code:
For iWord = 1 to 9
For iWord2=iWord-1 to iWord+1
If Array(iWord2)="FOX" then MARK THESE WORDS AS NOT IGNORABLE; OTHERWISE MARK THEM TO BE IGNORED LATER ON
Next iWord2
Next iWord
The problem is that with thousands of elements (and actually testing 5 words prior and 5 words after), the total iterations is a lot and takes too long currently.
Any suggestions? Basically I want to determine array elements are nearby to the key word ("fox") because ultimately I want to ignore all the other elements in a later loop.