On task recognition and generalization in long-term robot teaching