// Copyright 2015, University of Freiburg, // Chair of Algorithms and Data Structures. // Author: Hannah Bast . // NOTE: this file contains specifications and design suggestions in // pseudo-code. It is not supposed to be compilable in any language. The // specifications are mandatory, the design suggestions are not. // Class for a simple inverted index. Copy your code from sheet-01 and extend it // by BM25 scores, following the explanations in the lecture. In particular, // consider the implementation advice on slide 17. class InvertedIndex // Class for evaluating a given benchmark. class EvaluateBenchmark // Compute the P@k for a given result list and a given set of relevant docs. // See the explanation in the lecture, i.p. the example on slide 21. // Note that this can also be used to compute P@R by simply taking k as the // number of relevant ids. double precision_at_k(Array results_ids, Set relevant_ids, int k) // Compute the AP (avergae precision) of a given result list and a given set // of relevant docs. See the explanation in the lecture, i.p. the example on // slide 22. double average_precision(Array results_ids, Set relevant_ids) // Evaluate the given benchmark (in a file in the format of the one from the // Wiki) and return the requested measures (MP@3, MP@R, MAP). Tripe evaluate_benchmark(String file_name)