# MARIE: A Context-Aware Term Mapping with String Matching and Embedding Vectors
## 2 Methods
### Marie  
As described in Equation (1), MARIE calculates a term similarity between terms T\({}_{1}\) and T\({}_{2}\) as a weighted average of string matching methods and the cosine similarity of their embedding vectors from BioBERT. As long as the range of the resulting similarity score is between 0 and 1, any type of string matching methods can be incorporated into MARIE. To generate word embedding vectors, MARIE extracts the activations from the last few layers of BioBERT. When a term is composed of multiple words or tokens, MARIE uses the average of the constituting word or token embedding vectors to generate a final term vector. As both similarity measures are ranged between 0 and 1, the final similarity score computed from MARIE also lies between 0 and 1. Furthermore, a hyperparameter \(\alpha\) enables users to adjust the relative importance of the similarity scores calculated from each of the string matching methods and the BioBERT embedding vectors. Although \(\alpha\) is a user-defined hyperparameter, it enables MARIE to flexibly adjust its mapping capability to different datasets. To summarize the entire mapping process of MARIE, Figure 1 provides its overall flow diagram. The MARIE calculation method is as follows:  
\[S_{MET}(T_{1},\ T_{2})=(1-\alpha)S_{str}(T_{1},\ T_{2})+\alpha S_{BB(E_{1},\ E_{2})} \tag{1}\]  
\[E_{1},\ E_{2}=\text{Embedding vectors of T}_{1}\text{ and T}_{2},\ \text{ respectively}\]  
\[S_{MET}(T_{1},\ T_{2})=\text{ Similarity score from MARIE}\]  
\[S_{str}(T_{1},\ T_{2})=\text{ Similarity score from a string matching method}\]  
\[S_{BB}(E_{1},\ E_{2})=\text{ Cosine similarity between E}_{1}\text{ and E}_{2}\]The string matching methods and BioBERT use distinctively different criteria when calculating a similarity score between terms T\({}_{1}\) and T\({}_{2}\). The string matching methods purely rely on the structural similarities between the terms. On the other hand, BioBERT uses the distance between the embedding vectors E\({}_{1}\) and E\({}_{2}\). As these embedding vectors are trained to capture contextual dependencies between the terms, the distance between E\({}_{1}\) and E\({}_{2}\) is determined by the contextual similarities between T\({}_{1}\) and T\({}_{2}\). By combining these two approaches, MARIE utilizes both structural and contextual dependencies, thereby employing a richer set of criteria to define a similarity between T\({}_{1}\) and T\({}_{2}\). Previously, word embedding-based edit distance [36] had similarly attempted to incorporate contextual information in edit distance. However, MARIE is a generalized improvement upon this previous work. Besides edit distance, MARIE is capable of incorporating a wider selection of string matching methods, thereby further expanding its applicability in practice. Furthermore, the biggest improvement of MARIE is its choice of term embedding methods. Among various term embedding methods, the previous work relies on word2 vec [37] to generate term embedding vectors. However, word2 vec does not capture richer bidirectional contextual information between words. Furthermore, it does not employ WordPiece embedding, thereby suffering from an out-of-vocabulary issue. When the embedding vector of a term T\({}_{1}\) has not been trained, word2 vec is not capable of inferring its embedding vector. For this type of out-of-vocabulary term, word embedding-based edit distance simply ignores the contextual information and reverts back to a string matching method. However, BioBERT relies on WordPiece embedding to overcome this weakness of word2 vec. During training, BioBERT learns the embedding vectors of both input words and their subwords. Thus, when it needs to infer the embedding vector of T\({}_{1}\), it breaks T\({}_{1}\) into known subwords and estimates its embedding vector by adding up its subword embedding vectors. By using BioBERT instead of other term embedding methods such as word2 vec or GloVe [38], MARIE utilizes richer contextual dependencies between terms and is robust to new words.