$count{$thisword}{$previousword}++; $count{$previousword}{$thisword}++;
Do this for every word. That's it. Also you have two options: Handle '.' as a distinct word and words over sentence-boundaries won't be neighbors. Or ignore '.' and words will be neighbors even if they are in different sentences
In reply to Re: find words around a word in a file.
by jethro
in thread find words around a word in a file.
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |