I created a class to store settings for TF-IDF matrices generation.
class TFIDF_settings:
max_features = 5000
class word_level(TFIDF_settings):
analyzer = "word"
ngram_range = (1,1)
class ngram_level(TFIDF_settings):
analyzer = "word"
ngram_range = (2,3)
I would like the attribute TFIDF_settings.max_feature
to be smoothly passed to all of the inner classes - print(TFIDF_settings.word_level.max_features)
should return 5000
.
As you can see in the code, I thought that inheriting the outer class will do the job, but it throws an NameError
.
<ipython-input-18-0ddd9158decc> in TFIDF_settings()
2 max_features = 5000
3
----> 4 class word_level(TFIDF_settings):
5 analyzer = "word"
6 ngram_range = (1,1)
NameError: name 'TFIDF_settings' is not defined
Is there any way to (preferrably implicitly) pass the max_features
attribute of the outer class to the inner classes?