Extensive rewrite of corpus.R.  Will require fixing downstream functions, for instance dfm and kwic.