An automatic method for the recognition and classification of the A-phases of the cyclic alternating pattern