예제 #1
0
 def pretty_print(text, tags):
     spans = []
     for s, e, tag in bio_to_spans(text, tags):
         spans.append({"start": s, "end": e, "type": tag})
     ents = dict((obj["type"].lower(), obj) for obj in spans).keys()
     ret = {
         "doc_text": " ".join(text),
         "annotation_set": list(ents),
         "spans": spans,
         "title": "None",
     }
     print({"doc": ret, "type": "high_level"})
     return {"doc": ret, "type": "high_level"}
예제 #2
0
 def pretty_print(text, tags):
     spans = []
     for s, e, tag in bio_to_spans(text, tags):
         spans.append({'start': s, 'end': e, 'type': tag})
     ents = dict((obj['type'].lower(), obj) for obj in spans).keys()
     ret = {
         'doc_text': ' '.join(text),
         'annotation_set': list(ents),
         'spans': spans,
         'title': 'None'
     }
     print({"doc": ret, 'type': 'high_level'})
     return {"doc": ret, 'type': 'high_level'}
예제 #3
0
 def display_results(text_str, predictions, intent_type):
     ret = {
         "annotation_set": [],
         "doc_text": " ".join([t for t in text_str])
     }
     spans = []
     available_tags = set()
     for s, e, tag in bio_to_spans(text_str, predictions):
         spans.append({"start": s, "end": e, "type": tag})
         available_tags.add(tag)
     ret["annotation_set"] = list(available_tags)
     ret["spans"] = spans
     ret["title"] = intent_type
     return {"doc": ret, "type": "high_level"}
예제 #4
0
 def display_results(text_str, predictions, intent_type):
     ret = {
         'annotation_set': [],
         'doc_text': ' '.join([t for t in text_str])
     }
     spans = []
     available_tags = set()
     for s, e, tag in bio_to_spans(text_str, predictions):
         spans.append({'start': s, 'end': e, 'type': tag})
         available_tags.add(tag)
     ret['annotation_set'] = list(available_tags)
     ret['spans'] = spans
     ret['title'] = intent_type
     return {'doc': ret, 'type': 'high_level'}