PurposeQuestionnaire studies of knowledge, attitude and practice (KAP) are effective research in the field of health, which have many shortcomings. The purpose of this research is to propose an automatic questionnaire-free method based on deep learning techniques to address the shortcomings of common methods. Next, the aim of this research is to use the proposed method with public comments on Twitter to get the gaps in KAP of people regarding COVID-19.Design/methodology/approachIn this paper, two models are proposed to achieve the mentioned purposes, the first one for attitude and the other for people’s knowledge and practice. First, the authors collect some tweets from Twitter and label them. After that, the authors preprocess the collected textual data. Then, the text representation vector for each tweet is extracted using BERT-BiGRU or XLNet-GRU. Finally, for the knowledge and practice problem, a multi-label classifier with 16 classes representing health guidelines is proposed. Also, for the attitude problem, a multi-class classifier with three classes (positive, negative and neutral) is proposed.FindingsLabeling quality has a direct relationship with the performance of the final model, the authors calculated the inter-rater reliability using the Krippendorf alpha coefficient, which shows the reliability of the assessment in both problems. In the problem of knowledge and practice, 87% and in the problem of people’s attitude, 95% agreement was reached. The high agreement obtained indicates the reliability of the dataset and warrants the assessment. The proposed models in both problems were evaluated with some metrics, which shows that both proposed models perform better than the common methods. Our analyses for KAP are more efficient than questionnaire methods. Our method has solved many shortcomings of questionnaires, the most important of which is increasing the speed of evaluation, increasing the studied population and receiving reliable opinions to get accurate results.Research limitations/implicationsOur research is based on social network datasets. This data cannot provide the possibility to discover the public information of users definitively. Addressing this limitation can have a lot of complexity and little certainty, so in this research, the authors presented our final analysis independent of the public information of users.Practical implicationsCombining recurrent neural networks with methods based on the attention mechanism improves the performance of the model and solves the need for large training data. Also, using these methods is effective in the process of improving the implementation of KAP research and eliminating its shortcomings. These results can be used in other text processing tasks and cause their improvement. The results of the analysis on the attitude, practice and knowledge of people regarding the health guidelines lead to the effective planning and implementation of health decisions and interventions and required training by health institutions. The results of this research show the effective relationship between attitude, practice and knowledge. People are better at following health guidelines than being aware of COVID-19. Despite many tensions during the epidemic, most people still discuss the issue with a positive attitude.Originality/valueTo the best of our knowledge, so far, no text processing-based method has been proposed to perform KAP research. Also, our method benefits from the most valuable data of today’s era (i.e. social networks), which is the expression of people’s experiences, facts and free opinions. Therefore, our final analysis provides more realistic results.