## 3 Material and Method
### Step 1: Text Pre-Processing and Key Phrases Extraction
To represent the texts, we use bags of key phrases that were extracted as explained in step 1. Using these representations, we compute the similarity between the student's query and the test questions and posts using the Jaccard coefficient. Additionally, we compute the similarity between the titles and the main bodies of each post and query. Since titles usually contain the most important information from the body section, we assign double weight to the similarity between titles. 3. **Computing similarity using word embeddings**. We first convert the texts into embeddings and then calculate the cosine distance between the embeddings of each pair of posts. This allows us to map posts with similar meanings close together in vector space. To achieve this, we use the Sentence Transformers (ST) framework [33], which leverages a pre-trained BERT model to obtain the contextual representation of the posts. ST applies a mean pooling method to the output, which converts token embeddings to sentence embeddings of a fixed size. By default, this method averages the output embeddings. The Sentence Transformers framework provides a set of pre-trained models for various functionalities such as semantic search, semantic similarity, question answering, clustering, image and text, etc. Moreover, these models are generally available in English and only some of them have a multilingual version. In this work, we have selected the best pre-trained model for semantic similarity and which has a multilingual version since the analyzed texts are in Spanish. (The performance of the models available for this framework is available at [[https://www.sbert.net/docs/pretrained_models.html](https://www.sbert.net/docs/pretrained_models.html)]([https://www.sbert.net/docs/pretrained_models.html](https://www.sbert.net/docs/pretrained_models.html)) (accessed on 18 September 2023)). Some pre-trained models have several similarity functions such as dot-product or cosine or Euclidean distances. In particular, the model used has only one similarity function available which is the cosine distance. However, this function is the one that works best since this framework also has a loss function specially designed for the cosine distance (CosineSimilarityLoss). To compare each post and the student's query, we obtain embeddings for the title and the body separately. We also assign double weight to the similarity between titles, as they often contain the most important information. We utilized a BERT-based model to generate embeddings for both the title and the body of each post. BERT and other transformer networks produce embeddings for each token in the input text. To create a fixed-sized sentence embedding, the model applies mean pooling, which involves averaging the output embeddings for all tokens to yield a fixed-size vector. We used the multilingual model \"paraphrase-multilingual-mpnet-base-v2\" [33], which has been trained on parallel data for over 50 languages, including Spanish. The model is capable of generating aligned vector spaces, meaning that similar inputs in different languages are mapped closely in a vector space, without requiring explicit specification of the input language. This model maps sentences and paragraphs to a dense vector space of 768 dimensions, and can be employed for tasks such as text similarity, clustering, and semantic search. **Step 3: Ranking and Presentation**  
The posts and questions are sorted based on their similarity to the student's query, resulting in two separate rankings--one for posts and the other for questions. Within each ranking, the posts or questions are ordered in descending order of similarity to the query. The top-N posts/questions are then presented to the student. When ranking both posts and questions, we use the the three different approaches to compute the similarity presented in step 2: traditional bags of words, key phrases and word embeddings. The three different approaches are evaluated and the results are presented and compared in Section 5.