dkpro / dkpro-cassis

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

How to set a feature if the feature name is in a variable #175

Closed reckart closed 2 years ago

reckart commented 2 years ago

Is your feature request related to a problem? Please describe. I have a feature name but only in a variable. It does not seem to be possible to do a fs[myFeatureNameVar] = "bonkers". What works is setattr(fs, myFeatureNameVar, "bonkers") - but it does not seem to be terribly intuitive.

Describe the solution you'd like Since we have a get(featurename) method, maybe have a set(featurename, value) method?

Describe alternatives you've considered Maybe the x = fs[var]and fs[var] = x syntax could work?

jcklie commented 2 years ago

See https://github.com/dkpro/dkpro-cassis#getting-and-setting-nested-features