def _parse_response_content_for_predictions(self, question_number, response):
"""
Parses the json representation of the docs from the HTTP response and returns it as list predictions
with scores (and confidences if they exist)
:param str question_number: used as qid
:param requests.Response response:
:return: list of feature vectors
:rtype: list(list(str))
"""
response_content = response.json()
results = []
if response_content["matching_results"] > 0:
for doc in response_content['results']:
results.append(Prediction(qid=question_number, aid=doc[DOC_ID_FIELD_NAME], rank_score=doc['score'],
conf_score=None))
else:
self.logger.warn('Empty response: %s' % vars(response))
return results
discovery_wrappers.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录