Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Enhancement/Auto-generate label shortkeys and colors on corpus import #199
In #5 (comment), @jamesmf brought up the suggestion to auto-generate shortkeys and colors for each imported label. This idea provides a great improvement to the user experience since the user can upload a partially annotated corpus and quickly start annotating efficiently afterwards thanks to all the shortkeys and colors already being assigned.
This pull request implements the automatic generation of label shortkeys and colors when a corpus is imported.
For each new label, we attempt to use the first character of the label text as the shortkey. If this is already set, we add modifier keys like ctrl, shift and ctrl+shift until we find a shortkey that doesn't yet exist. If all the shortkeys already exist, we move onto the next character in the label text and try again.
For each new label, we also auto-generate a background color and a foreground color as per the same algorithm that the frontend uses.