knowledge based system for grocery bag template automation