Move code for documents and corpus into separate library package.