A developer is building a text classification model to organize legal contracts. The documents contain a vast vocabulary with specialized jargon and numerous synonyms (e.g., "attorney", "counselor", "counsel", "lawyer"). Which text representation model will best capture the semantic relationships between these terms to improve classifier performance?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Imagine you're building a system to sort legal documents, and you've got one contract that uses the word "attorney" and another that uses "lawyer". If you use a traditional method like Bag-of-Words or One-Hot encoding, the computer treats those as two completely unrelated strings. It has no idea they mean the same thing! That means your model will struggle to generalize. By using dense word embeddings like Word2Vec or GloVe, the model maps words based on their actual semantic meanings. Because "attorney" and "lawyer" appear in similar contexts in legal texts, their vector coordinates are placed very close to each other. This allows the classifier to understand that they are related, making Option D the best choice.
Full explanation below image
Full Explanation
In text classification, capturing semantic similarity is critical when dealing with domain-specific jargon and synonyms. - Word Embeddings (Option D) represent words as dense, low-dimensional vectors in a continuous vector space (typically 100 to 300 dimensions). These models are trained on large corpora to place semantically similar words near one another in this space. For a classifier, this means that even if a training document contains "attorney" and a test document contains "lawyer," the model can utilize the proximity of their vectors to make accurate predictions. - One-Hot Encoding (Option A) represents words as sparse, high-dimensional vectors where only one index is 1 and all others are 0. The dot product between any two distinct word vectors is always 0, meaning it cannot capture any semantic relationship between synonyms. - Bag-of-Words (Option B) and TF-IDF (Option C) are vocabulary-dependent sparse models. They represent documents by word counts or statistical weights, treating each word as an independent feature. They do not model word semantic similarity, making them less effective at generalizing across different synonyms.