Class ItemLists doesn’t have method “label_for_lm”. “label_for_lm” is the method of Class TextList.
Could someone explain why the code “ItemLists(path=path, train=train, valid=valid).label_for_lm()” can work?
Class ItemLists doesn’t have method “label_for_lm”. “label_for_lm” is the method of Class TextList.
Could someone explain why the code “ItemLists(path=path, train=train, valid=valid).label_for_lm()” can work?
It would work if train
and valid
are TextList
since the function label_for_lm
is delegated there.
Yes, I found that. ItemLists will call getattr method to use TextList.label_for_lm, and change the class of ItemLists to LabelLists. That’s really cool!