  A language is made up of an infinite/finite number of sentences, which in
turn is composed of a number of words. The Electrocardiogram (ECG) is the most
popular noninvasive medical tool for studying heart function and diagnosing
various irregular cardiac rhythms. Intuitive inspection of the ECG reveals a
marked similarity between ECG signals and the spoken language. As a result, the
ECG signal may be thought of as a series of heartbeats (similar to sentences in
a spoken language), with each heartbeat consisting of a collection of waves
(similar to words in a sentence) with varying morphologies. Just as natural
language processing (NLP) is used to help computers comprehend and interpret
human natural language, it is conceivable to create NLP-inspired algorithms to
help computers comprehend the electrocardiogram data more efficiently. In this
study, we propose a novel ECG analysis technique, based on embedding and self
attention, to capture the spatial as well as the temporal dependencies of the
ECG data. To generate the embedding, an encoder-decoder network was proposed to
capture the temporal dependencies of the ECG signal and perform data
compression. The compressed and encoded data was fed to the embedding layer as
its weights. Finally, the proposed CNN-LSTM-Self Attention classifier works on
the embedding layer and classifies the signal as normal or anomalous. The
approach was tested using the PTB-xl dataset, which is severely imbalanced. Our
emphasis was to appropriately recognise the disease classes present in minority
numbers, in order to limit the detection of False Negative cases. An accuracy
of 91% was achieved with a good F1-score for all the disease classes.
Additionally, the the size of the model was reduced by 34% due to compression,
making it suitable for deployment in real time applications
