The current suite of algorithms used in intelligent mineral sorting equipment is largely generic, lacking the necessary adaptability and the capability for simultaneous non-destructive structural detection and quantitative analysis. To address this, we have developed two specialized algorithms based on X-ray absorption spectroscopy: the Trans-LSTM algorithm based on Transformer and Long Short-Term Memory(LSTM), utilizing knowledge distillation for rough mineral sorting, and the RNN-overhead-xgboost algorithm based on Recurrent Neural Network(RNN) for fine mineral sorting. We collected 3000 X-ray absorption spectra from 15 types of minerals with similar appearances or compositions. We compared the performance of these proposed algorithms with three other general-purpose algorithms for mineral spectral classification. Our study specifically examined the impact of Trans-LSTM on rough mineral sorting and the effect of RNN-overhead-xgboost on fine mineral sorting. In the rough sorting stage, the Trans-LSTM model demonstrated a prediction time of just 0.0171 s per sample, maintaining a classification accuracy of 93.49%, thereby ensuring high precision with high efficiency. During the fine sorting stage, the RNN-overhead-xgboost algorithm significantly improved sorting accuracy to 99.21%, highlighting its effectiveness in achieving precise sorting. These findings underscore the potential of the Trans-LSTM and RNN-overhead-xgboost algorithms to enhance the adaptability and accuracy of intelligent mineral sorting systems, meeting the specific demands of different stages in mineral production.