in reply to a question about making a word frequency matrix

Not precisely what you asked for, but since you appear to be in danger of reinventing wheels, I thought I'd point out that there are many mature packages available for handling NLP-related tasks. You may see planetscape's scratchpad for some; don't neglect Super Search either, which you can use to turn up things like Ted Pedersen's Ngram Statistics Package by searching for "ngram" or "word frequency"...

HTH,

planetscape
  • Comment on Re: a question about making a word frequency matrix