A Smart Framework for Automatically Analyzing Electrocardiograms