Is there a way to `term.remove_synonym("something")` ?
hrshdhgd opened this issue · 2 comments
hrshdhgd commented
Hello,
I have Term
object (t) and t.synonyms
is of type frozenset
(as you'd already know). I want to remove one synonym out of t.synonyms
using
t.synonyms = frozenset([syn for syn in t.synonyms if syn.description != synonym_to_removed])
This does not work and gives me the error:
TypeError: 'synonyms' must be <unknown>, not frozenset
The error isn't clear. What does it mean?
Any suggestions would be appreciated!
hrshdhgd commented
For now the following solution worked:
synonym_to_remove = [syn for syn in t._data().synonyms if syn.description == patch.old_value][0]
t._data().synonyms.discard(synonym_to_remove)
If there's another way of doing this, please let me know. Thanks!