## 4 Methodology
### Enabling Lhia to Answer Questions  
Every user interaction has a purpose, called user intent [46]. Intent classification is the automatic categorization of text data based on user goals. An intent classifier analyzes the texts and categorizes them into intents. Intent classification can use DL-based NLP pipelines to automatically associate words or sentences with a given user intent (i.e., NLU). _Rasa_ needs to understand user input messages, and the understanding of messages occurs by using pipelines responsible for sequentially processing user messages. A pipeline has components that handle different tasks, such as entity management, intent classification, and response selection. In the _Rasa_ platform, pipelines are configured in the config.yml file using five components [47]: language models, tokenizers, featurizers, intent classifiers, and response selector. In the first version of the chatbot (i.e., before starting the co-design procedure), sentences related to each problem faced by mothers who breastfeed (i.e., classes in a machine learning multiclass classification problem) were collected through interviews with 18 health professionals, and then used to perform the pipeline training before the first co-design round. During the entire co-design process, the dataset was improved from the data collection during user interactions. _Rasa_ uses the following three files to perform the pipeline training:  
* _nlu.yml_ has all problems faced by mothers categorized as intents, and each intent contains sentence samples;
* _domain.yml_ contains the answers and actions for each corresponding intent in the _nlu.yml_ file;
* _stories.yml_ contains the conversational flow based on stories, in which each story contains one or more intents. As described in Table 2, we defined five different _Rasa_ pipelines to carry out experiments to find the one with the best performance, considering accuracy as a metric (Equation (2)), which is based on the confusion matrix. The dataset was divided into 80% for training/validation and 20% for testing. In each co-design round, we deployed the pipeline that performed best in the training session that used data added from the previous round. However, after all rounds in the co-design procedure and after the pipeline that performed best has been identified, we trained it with 100% of the data to be deployed in the _Lhia_ chatbot. \[Accuracy=\frac{correct\ classifications}{all\ classifications} \tag{2}\]  
Figure 2: _Lhia_ Architecture. Each component present in pipelines described in Table 2 is described below. * _WhitespaceTokenizer_ component is responsible for the initial pre-processing step, in which texts are divided into smaller units (words or characters), i.e., unique tokens. This separation occurs from the white spaces between each word or character, and has user messages as input, and a list of unique tokens as output;
* _LexicalSyntacticFaturizer_ is a component responsible for extracting features such as keywords, sequences of relevant words, grammatical categories, n-grams, and lexical properties. Furthermore, it uses word processing techniques to analyze the grammatical structure and lexical properties of the input sentences;
* _CountVectorFaturizer_ identifies the frequency of words, without considering their contextual or semantic meaning in the sentences;
* _DIETClassifier_ is the component with the Dual Intent and Entity Transformer (DIET) [31], which is a multitasking architecture for intent classification and entity recognition. It outputs the confidence scores for each possible intent associated with the user message;
* _FallbackClassifier_ component is responsible for handling occasions when the chatbot cannot classify an intent. It provides a default response when a fallback is triggered (i.e., the fallback response). We tested pipelines with the pretrained model DIET acting as classifier, which already has demonstrated high performance [31].