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

Merging type systems that contain the same types triggers tons of warnings #253

Closed reckart closed 2 years ago

reckart commented 2 years ago

Describe the bug When merging two almost-same type systems in cassis, it triggers tons of warnings in the line of feature XXX already defined in YYY.

To Reproduce

Expected behavior The warning should only be triggered if a subtype redefines a feature that was already defined in a super-type (and even then it might be a bit annoying as it is). But if two identical or nearly identical types are merged, there should be no warning.

Please complete the following information:

Additional context https://github.com/averbis/averbis-python-api/pull/112

jcklie commented 2 years ago

You can disable warnings in python either by specifying a filter 1 or via a context manager 2. Is that not an option for you? I would rather not remove the warning and I do not see the need to add a function that globally disables these warnings as you can do it from the Python stdlib.

reckart commented 2 years ago

We have two cases:

1) merging two basically identical types 2) a subtype re-defines a feature already defined by a supertype

For 1, I think there should not be a warning. If you think there should be one, why?

For 2, I am also not sure if there should be a warning - why do you think again there should be one?

jcklie commented 2 years ago

The warnings do not come from merging directly, but from the adding features function. I find it good that you get warned when adding an existing feature or redefining something of the parent. Maybe I can disable warnings during merging, but you could do it also in application code.

reckart commented 2 years ago

Warnings should be generated things where we have a strong feeling that the programming is making a mistake or that the API is abused. Redefining a feature in a subtype could be a mistake. But as part of type system merging, it is not uncommon that types are defined in different type systems to be merged - and it is not a case of sub-type feature redefinition - it is a case of same-type feature redefinition with exactly the same definition. This case should not produce a slew of warnings.