Intelligent labeling system