result = []
for qidx in range(n_queries):
    qresult = [self.custom_similarity(document, query[qidx]) for document in
        self.corpus]
qresult = numpy.array(qresult)
result.append(qresult)
if len(result) == 1:
    result = result[0]
else:
    result = numpy.array(result)
return result
gensim: custom similarity measure