dkpro / dkpro-cassis

UIMA CAS processing library written in Python
https://pypi.org/project/dkpro-cassis/
Apache License 2.0
85 stars 22 forks source link

Function to rename Views #279

Open DavidHuebner opened 1 year ago

DavidHuebner commented 1 year ago

Is your feature request related to a problem? Please describe. In some scenarios, it might be helpful to rename a View. As an example, consider the evaluation scenario where we normally go through the following steps.

  1. Load a CAS with label information / annotations into the _InitialView.
  2. Rename the _InitialView to goldView.
  3. Make predictions with a model/pipeline and store the predictions in the _initialView.
  4. Compare results from _InitialView to goldView

One may ask why we want to have the predictions in the _InitialView and not in a new view. The reason is mainly because the Eclipse UIMA Annotation Plugin opens the _InitialView as default and otherwise one would always manually need to switch the view to see the predictions. This behavior is in line with cassis, where also the _InitialView is opened initially.

Describe the solution you'd like I would like to have a function cas.rename_view(view_name: str) that

  1. renames the currently active View, which is specified in cas._current_view, to view_name
  2. switches the cas._current_view to view_name
  3. returns the new View

Describe alternatives you've considered An alternative would be an annotation copier that allows copying a set of annotations from one view to another. But for this specific use-case, this is certainly slower and more effort.

Additional context If you agree on the parameter/scope of the function, then I can implement it.