I need to display some information to the annotator. This information is computed (like pre-labeling) by a model, and displayed to the annotator for easier labeling.
But I don't want to save this information in the labels.
Is there anyway to have data computed by a model and displayed to the user without saving it as label ?
Is it textual information? Have you an example?
Basically I just want to show the number of tokens in a text.
So the unlabeled data is just text, I would like to display the number of tokens in this text (so, run some code to tokenize the input data and count the number of tokens). Then the user can see this information and label the data.
This information should not be saved as label though.
Can you describe more detailed why don't you want to use label config for this info?
For example this way.
Thank you ! That seems perfect for my use case. However I don't understand where the number of tokens is computed ?
It's a little bit different. Sorry to confuse you. Tokens are calculated by hands.
For this label config:
<View>
<Header value="$**header**"/>
<Text name="text" value="$**text**"/>
<Choices name="sentiment" toName="text" choice="single">
<Choice value="Correct"/>
<Choice value="Wrong"/>
</Choices>
</View>
Your tasks json for import to LS will be:
[
{ "header": "Token count = 3", "text": "1 2 3"},
{ "header": "Token count = 4", "text": "1 2 3 4"}
]
So, you need to calculate token count before import. Is it ok for you?
Example in python:
import json
texts = ['1 2 3', '1 2 3 4']
import_tasks = []
for text in texts:
task = {
'header': 'Token count = ' + str(len(text.split())),
'text': text
}
import_tasks.append(task)
json.dump(import_tasks, open('import_tasks.json', 'w'))
If you need the real integration with machine learning backend then we have support for ML backends and predictions for tasks on the fly. But it's more difficult.
Thanks for the detailed answer !
I would be interested in the ML backend, but as far as I understood, ML backend can predict only labels, am I right ?
Can it predict something else ? (the content of header in my case) So it would not be saved as labels.
ML can predict every tag that has name=xxx attribute. The prediction format will use these names as output keys in json results. And predictions are very similar to completions. Read more about predictions in the docs:
https://labelstud.io/guide/tasks.html#Basic-format
So, you can have