Aim) Community-acquired pneumonia (CAP) is a type of pneumonia acquired outside the hospital.(Methods) To recognize CAP more efficiently and more precisely, we propose a novel method-wavelet entropy (WE) is used as the feature extractor, and cat swarm optimization (shortened as CSO) is used to train an artificial neural network (ANN). Our method is abbreviated as WE-ANN-CSO. (Results) This proposed WE-ANN-CSO algorithm yields a sensitivity of 91.64±0.99%, a specificity of 90.64±2.11%, a precision of 90.96±1.81%, an accuracy of 91.14±1.12%, an F1 score of 91.29±1.04%, an MCC of 82.31±2.22%, an FMI of 91.29±1.03%, and an AUC of 0.9527.(Conclusions) This proposed WE-ANN-CSO algorithm provides better performances than four state-of-the-art approaches.