def get(self, model_id, document_id):
"""
Get all info about documents and topics assigned to document document_id in model model_id
:param model_id:
:param document_id: string, the document id
:return:
"""
parser = reqparse.RequestParser(bundle_errors=True)
parser.add_argument('threshold', default=config.defaults['minimum_threshold']['value'], required=False,
type=float,
help='The minimum probability that a topic should '
'have to be returned as related to the document.')
args = parser.parse_args()
threshold = args['threshold']
data = db_utils.get_document(model_id, str(document_id), topics_threshold=threshold)
if data is None:
return api_utils.prepare_error_response(400, 'Document not found', more_info={'model_id': model_id, 'document_id': document_id})
data['threshold'] = threshold
data['model_id'] = model_id
return api_utils.prepare_success_response(200, 'Document retrieved.', marshal(data, api_utils.document_fields))
评论列表
文章目录