Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement/Auto-generate label shortkeys and colors on corpus import #199

Merged

Conversation

c-w
Copy link
Member

@c-w c-w commented May 15, 2019

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.

@c-w c-w force-pushed the enhancement/auto-generate-label-shortkeys branch from a09297d to e37e16b Compare May 15, 2019 16:19
@c-w c-w changed the title Enhancement/Auto-generate label shortkeys on corpus import Enhancement/Auto-generate label shortkeys and colors May 15, 2019
@c-w c-w force-pushed the enhancement/auto-generate-label-shortkeys branch 4 times, most recently from 2d96288 to 42e1d2d Compare May 15, 2019 18:55
@c-w c-w force-pushed the enhancement/auto-generate-label-shortkeys branch from 42e1d2d to 606ecfa Compare May 15, 2019 18:56
@c-w c-w changed the title Enhancement/Auto-generate label shortkeys and colors Enhancement/Auto-generate label shortkeys and colors on corpus import May 15, 2019
app/server/utils.py Outdated Show resolved Hide resolved
@Hironsan Hironsan merged commit 17b9d3b into doccano:master May 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants