Watson NLU Order Of entities returned

164 views Asked by At

I am using watson NLU along with a custom model to extract education entities from a resume.

So far, it works okay, but if there is more than one education mentioned, it doesn't return the result in order.

for example, if a resume contains high school and university, it returns the data in the wrong order as shown below:

 {
    "type": "GraduationYear",
    "text": "2007",
    "disambiguation": {
        "subtype": [
        "Date"
        ]
    },
    "count": 1
},
{
    "type": "Institution",
    "text": "Rahman Colledge",
    "disambiguation": {
        "subtype": [
        "CollegeUniversity"
        ]
    },
    "count": 1
},
{
    "type": "GraduationYear",
    "text": "2017",
    "disambiguation": {
        "subtype": [
        "Date"
        ]
    },
    "count": 1
},

{
    "type": "Institution",
    "text": "MIS Highschool",
    "disambiguation": {
        "subtype": [
        "School"
        ]
    },
    "count": 1
},
{
    "type": "EducationLevel",
    "text": "Diploma",
    "disambiguation": {
        "subtype": [
        "Degree"
        ]
    },
    "count": 1
},
{
    "type": "EducationLevel",
    "text": "High School Certfication",
    "disambiguation": {
        "subtype": [
        "Degree"
        ]
    },
    "count": 1
}

How can I order the results found from the model itself ?

1

There are 1 answers

0
a-ro On BEST ANSWER

There is a new mentions parameter in the NLU API that returns the locations of the entities in the text when set to true. You can then use the start index of each entity to order them. See the NLU API reference.