Inserting Span and Arrow Label into Document
In Span Based Labeling, we have 2 different kinds of label:
Span Label: Label applied to a span of tokens
Arrow Label: Label which points from a Span Label to another Span Label
cURL
Use the following cURL command to get label sets added to a project. You can copy and paste the following template and replace the access_token and the content of the label set items according to your needs.
Below is a more readable version of the above curl command's request body.
The request above will produce span and arrow labels like the following:
operationName: you can fill any alphanumeric string in as the operationName. Refer this page for best practices on choosing an
operationName
.variables:
input:
documentId: string, ID of the targeted document where the label will be inserted.
signature: hash of the document to ensure the structure of the sentence / spans of the document has not changed when inserting label. You can obtain the signature value by following the instruction in this page.
labels:
id: the unique identifier of a label.
If the ID has 9 segments, this indicates a span label. For example,
INNM0ViFwo8LluMTaTIK9:0:0:14:0:0:18:6:0
and here's the explanation<label set item id>:<layer>:<sidS>:<s>:<charS>:<sidE>:<e>:<charE>:<index>
.If the ID has 21 segments, this indicates an arrow label. For example,
tfc1FkbbEk9fOLx6haR1s:0:INNM0ViFwo8LluMTaTIK9:0:0:14:0:0:18:6:0:Oq_VuB0s_N7D8ZY0rgYsg:0:0:0:0:0:2:5:0:0
and here's the explanation<label set item id>:<arrow layer>:<….. origin id>:<….destination id>:<arrow index>.
layer: indicates the index of the label set.
l: the label set item ID of the label set. You can obtain the label set information of a project including the label set item ID in this page.
start:
sentenceId: starting line of the label
tokenId: starting token of the label
charId: starting character index of the label
end:
sentenceId: ending line of the label
tokenId: ending token of the label
charId: ending character index of the label
deleted: boolean, set true if you want to delete the existing label
query: Copy this from the example above.
💡a tag has the same meaning as label. In the near future, we will update the GraphQL Schema to refer to all instances as labels.
Response
Here is the response you can expect after issuing the cURL command. Use the id to create the project.
Last updated