Clustering of documents from a two-way viewpoint