How to Rename the Target Column in Annotation Results for Text Classification Projects

Question:

In a text classification project, using the sentiment analysis template has automatically set my target column name to “sentiment” in the annotation results. I want to rename this to something that better fits my project, but I’m encountering an error when trying to change the name field in the Choices element. How do I properly rename the target column without affecting my existing annotations?

Answer

To rename your target column without losing any annotations, you can follow these steps by exporting your annotations and using the label-studio-converter tool:

  1. Export your annotations from Label Studio in the JSON format.
  2. Open the exported JSON file with a text editor or script and conduct a find-and-replace operation, changing the from_name field from “sentiment” to your new desired target column name.
  3. After having renamed the field, use the label-studio-converter tool to convert your JSON back into your preferred data format (CSV, TSV, etc).

This process is a safe way to update your annotation results without having to alter the underlying SQLite database, ensuring that your valuable annotations remain intact. As always, make sure to back up your data before proceeding with any changes.

Additional Tips:

  • Always verify that the new from_name is consistent across your file before converting.
  • While the Label Studio UI may not permit certain changes, manipulating the exported data outside the software provides more flexibility.