Custom Code
Functions available:
this.allowSubmission(Boolean)
this.changeFormValue(field_name, new_value)
this.enableField(field_name, Boolean)
this.disableField(field_name)
this.mandatoryField(field_name, Boolean)
this.changeInputValue(field_name, value)
this.hideOutputField(["field_name1", "field_name2"],"template_name")
this.unHideOutputField(["field_name1", "field_name2"],"template_name")
this.hideInputField(["field_name1", "field_name2"],"template_name")
this.unHideInputField(["field_name1", "field_name2"],"template_name")
this.hideUserBulkTaskButtons(["button 1 name", "button 2 name", …n])
this.unHideUserBulkTaskButtons(["button 1 name", "button 2 name", …n])
let value = JSON.stringify(finalValues)
this.updateAnnotations(value)
let errorMsgs = []if(errorMsgs.length > 0) {
this.displayErrors(errorMsgs)
this.disAllowSubmit(true)
} else {
this.disAllowSubmit(false)
}
this.changeAnnotationClasses(newClass);
let inputText = inputValues[field_name]
let currentUserId = localStorage.getItem("userId")
if(currentUserLevel === 1) {
this.changeFormValue(field_name, `${currentUserId}`)
}
For NER:
let entities = _.get(annotations, "[0].value.annotations.entities", _.get(annotations, "annotations.entities", []))
To access form values in On-Change/on-Validation/On-save(also console the values coming from values and formValues then use as required):
let fieldNameValue = values["field_name"]
To access previous values in the on change code: (Useful to check if a particular field's value has changed')
let preValues = oldValues["field_name"]
To access annotations data in any annotation project
let anns = annotations
Examples:
Audio transcription validation: No special characters allowed, tags validations, etc.
let regexNotToMatch = {
"Add at least one space before the normal start tag.": /[^ ]<[^\/]*[^\/]*>/g,
"Add at least one space after the normal end tag.": /<\/\s*[^>]*>[^ ]/g,
"Add at least one space before and after a single tag.": /[^ ]<[^>]*\/>[^ ]|[^ ]<[^>]*\/>|<[^>]*\/>[^ ]/g,
"Numbers are not allowed.": /[0-9]/g,
"Special character: ^ ( ) { } [ ] ; : $ % * = are not allowed.": /[\^(){}\[\];:$%*=]/g,
"New line/Enter is not allowed.": /\n/g,
};
this.setState({ audioRegexNotToMatch: regexNotToMatch });
2. Generate 100 segments of transcription on load of a task:
let finalValues =[]
let i=0
while(i < 100 ) {
i = i + 1
finalValues.push( {
"id": i,
"curTime": 0,
"endTime": i + 1,
"startTime": i ,
"UIstartTime": i + 1,
"UIendTime": i,
"split": 0,
"audiourl": "",
"pos": 0,
"transliterationData": "abc def ghi jxy lzg".split(" ").map(w => ({
"word": w,
"tags": [],
"languageTag": "",
"editedText": ""
}))
})
}
let x = JSON.stringify(finalValues)
this.updateAnnotations(x)
3. Load classes for annotation projects using custom code:
4. Add groups for image and video annotation using custom code:
5. Load pre-annotations and classes from YOLO data
6. Load pre-annotations from an input field (When imported from cloud json files)
7. Group label mandatory check for all objects
8. NER: Load pre-annotations
9. Track QC rejections using custom field.
10. Format the NER output to plain text and write to an output field.
11. Convert SRT to Taskmonk JSON and load pre-annotation for audio transcription.
12. On load custom code to convert gdrive sharing urls to viewing url.
13. Excel view: Update all visible tasks based on changes in one task
14. Enable/Disable Buttons:
The following custom code can be plugged in to disable/enable a few actions buttons conditionally.
i. To hide user action buttons
ii. To unhide user action buttons
Available options for button names:
15. Enable/Disable fields in Excel View/Bulk tasks.
16. Extract ASIN,customID and keywords from Amazon URL’s
17. Generate rows in a name-value pair field
Calculation of IOU at level 3 for rejection logic