Ejemplo n.º 1
0
 def test_get_annotation_by_index(self):
     session = EngineFactory.create_session()
     annotation = DocumentSentenceTextAnnotation.get_annotation_count_by_index(
         session, 1, 1)
     expected = -1
     print annotation
     self.assertEqual(expected, annotation)
Ejemplo n.º 2
0
def get_annotation_count_by_index():
    if not request.json:
        return "fail"
    j = request.json
    if 'doc_id' not in j and "sentence_id" not in j:
        return "fail"
    doc_id = j["doc_id"]
    sentence_id = j["sentence_id"]
    sentence_annotation = DocumentSentenceTextAnnotation.get_annotation_count_by_index(
        api_entity_session, doc_id, sentence_id)
    if sentence_annotation:
        return jsonify({"annotation_count": sentence_annotation})
    else:
        return jsonify({"annotation_count": -1})