DataTurks-Engg / Entity-Recognition-In-Resumes-SpaCy

Automatic Summarization of Resumes with NER -> Evaluate resumes at a glance through Named Entity Recognition
https://medium.com/@dataturks/automatic-summarization-of-resumes-with-ner-8b97a5f562b
442 stars 215 forks source link

Read annotated data with Doccano #7

Open asriabdelhakim opened 5 years ago

asriabdelhakim commented 5 years ago

Hi, Please how can i read my annotated data with another tool named Doccano. 1) Here is my annotated data's form:

"annotation": [ [ 79, 99, "Nom complet" ],

2) The code that i want to change to read my annotated data:

    for line in lines:
        data = json.loads(line)
        text = data['content']
        entities = []
        for annotation in data['annotation']:
            #only a single point in text annotation.
            point = annotation['points'][0]
            labels = annotation['label']
            # handle both list of labels or a single label.
            if not isinstance(labels, list):
                labels = [labels]

            for label in labels:
                #dataturks indices are both inclusive [start, end] but spacy is not [start, end)
                entities.append((point['start'], point['end'] + 1 ,label))