Skip to content

Implementation of a Vector Space Retrieval Model using TF-IDF and cosine similarity on the Cranfield document corpus

Notifications You must be signed in to change notification settings

samujjwaal/Cranfield-Vector-Space-Model

Repository files navigation

Cranfield Corpus Vector Space Model

This project was done as a homework assignment for CS582: Information Retrieval course at the University of Illinois at Chicago during the Spring 2020 term.


The dataset used was the Cranfield collection which is a standard Information Retrieval text collection, consisting of 1400 documents from the aerodynamics field.

Each document in the collection are in SGML format. So the SGML tags (e.g.,<TITLE>, <DOC>,<TEXT>, etc.) have been eliminated and only the text between the <TITLE> and <TEXT> tags have been retained for building the Vector Space Retrieval Model.

For the tasks in this assignment the pre-processing tools implemented in this project were reused. The documents after cleaning were stored in a new folder.

There is also a list of queries and a list of relevant documents for each query provided, to calculate the precision and recall values of the retrieval model. The evaluation metrics are saved in an output file.

The same text pre-processing operations were applied on both the corpus documents and the queries.


The tasks in the assignment included:

  1. Implement an indexing scheme based on the vector space model. TF-IDF used for weighting scheme.

  2. For each of the queries, determine a ranked list of documents, in descending order of their cosine similarity with the queries.

  3. Determine the average precision and recall for the queries, using top 10, 50, 100 and 500 documents in the ranking.

Check out the Jupyter Notebook to see the python implementation of the tasks.