# Reversal of the Word Sense Disambiguation Task Using a Deep Learning Model
## 2 The WSD Framework
However, NER typically covers a limited range of semantic categories compared with WSD. In spaCy and similar libraries (e.g., Stanford CoreNLP [14]), NER addresses only a subset of noun phrases. This framework proposes aligning the NER categories with their corresponding hypernyms in WordNet, potentially leveraging the existing NER functionalities to support WSD. By contrast, the WordNet WSD module independently identifies words and phrases that are suitable for disambiguation, going beyond the limitations of NER. Two widely recognized NLP libraries, spaCy and Stanford CoreNLP, were subjected to experimentation. Individual Colab documents were generated for each library, presenting a comprehensive illustration of their potential in addressing the problem of word sense disambiguation. The subsequent discussion centers on the spaCy library, with the understanding that the outlined principles are equally applicable to the Stanford CoreNLP library. **KerasNLP BERT. ** A crucial element of the proposed WSD method is the integration of the KerasNLP. This library offers the capability to leverage various pretrained deep neural network models, enabling further training on fresh data or the extraction of embedded word vectors. In the context of this research, the focus was on showcasing the outcomes derived from using the BERT neural network. BERT's adeptness lies in its capacity to generate embedding vectors for words within a sentence, a process that is integral to assessing the significance of each word synset. By using BERT's word embedding vectors, we aimed to enhance the precision and granularity of the results of disambiguation, thereby reinforcing the overall efficacy of our WSD approach. **Word alignment. ** The integration of the spaCy NLP and KerasNLP modules stands as a pivotal aspect of our methodology. These modules operate independently, each generating its own tables of words (or tokens, in the case of KerasNLP). However, due to potential disparities between these tables, an additional step is necessary to establish correspondence. This entails creating an index that maps spaCy's words to their respective tokens in KerasNLP. The algorithm facilitating this matching process is straightforward and involves the following key steps:  
1. Through sequential scanning of the spaCy word table, each word is matched to the beginning of a token from the list generated by BERT's tokenizer. 2. To identify the corresponding beginning of the word (token) from the BERT module, consecutive tokens are successively combined and compared against the given spaCy word. Upon finding a match, the index of the first located BERT token is returned. This iterative process ensures the alignment of spaCy words with their corresponding tokens in KerasNLP, facilitating integration within the WSD framework. **NLTK WordNet. ** The NLTK WordNet module is a key component of our WSD methodology, as it provides a convenient API for accessing the WordNet dictionary. This module helps us assign synset values to words that either have no sample sentences or have only one synset value. Furthermore, the choice of the NLTK WordNet module was driven by important non-functional requirements that emerged during the project's development. One of these requirements was the compatibility of the WSD system code with the Google Colab environment, especially when using the \"Run all\" menu option. Among the various approaches to the WSD problem that have been proposed in the last 30 years, only the NLTK WordNet module, along with its WSD Lesk algorithm [15], fulfilled this requirement. This demonstrates the NLTK WordNet module's dependability and flexibility, making it an essential element of our WSD framework. **NCA projections. ** The Nearest Neighbor (KNN) algorithm is a simple yet powerful method for solving the problem of word sense disambiguation. It only depends on one parameter, and its accuracy improves as more training data become available. However, KNN faces a significant challenge when applied to the WordNet WSD problem.