HumanSignal / label-studio-frontend

Data labeling react app that is backend agnostic and can be embedded into your applications — distributed as an NPM package
https://labelstud.io/
Apache License 2.0
421 stars 316 forks source link

Inconsistent completions - NER HTML tagging #165

Open hipek8 opened 3 years ago

hipek8 commented 3 years ago

Exported completions are different depending on order of selection. Tested on labelstudio.io/playground/ With config

<View>
  <HyperTextLabels name="ner" toName="text">
    <Label value="Person" background="green"/>
    <Label value="Organization" background="blue"/>
  </HyperTextLabels>

  <View style="border: 1px solid #CCC;
               border-radius: 10px;
               padding: 5px">
    <HyperText name="text" value="$text"/>
  </View>
</View>

I tagged the same regions with the same labels but in different order. These are the results:

Zrzut ekranu 2021-01-29 o 11 57 12

Note: different start/end index and different offset.

g-simmons commented 3 years ago

Another example from the playground > HTML NER Tagging below. It looks like creating an annotation updates the DOM, and further annotations on the same HTML tag are with respect to this updated DOM.

image


Output preview

[
    {
        "value": {
            "start": "/div[1]/div[1]/div[1]/p[1]/text()[1]",
            "end": "/div[1]/div[1]/div[1]/p[1]/text()[1]",
            "startOffset": 2,
            "endOffset": 4,
            "text": "No",
            "htmllabels": [
                "Person"
            ]
        },
        "id": "Y_g00erjMS",
        "from_name": "ner",
        "to_name": "text",
        "type": "hypertextlabels"
    },
    {
        "value": {
            "start": "/div[1]/div[1]/div[1]/p[1]/text()[2]",
            "end": "/div[1]/div[1]/div[1]/p[1]/text()[2]",
            "startOffset": 1,
            "endOffset": 3,
            "text": "no",
            "htmllabels": [
                "Person"
            ]
        },
        "id": "n2zCeAS99-",
        "from_name": "ner",
        "to_name": "text",
        "type": "hypertextlabels"
    }
]
makseq commented 3 years ago

Relative: https://github.com/heartexlabs/label-studio/issues/778 https://github.com/heartexlabs/label-studio/issues/1164

makseq commented 3 years ago

@hipek8 @g-simmons Hope it's fixed in the latest master branch.