Free Master of Data Science Natural Language Processing Questions and Answers — Questions and Answers
Question 1: The combination of N keywords is known as a "N-gram."
- 10
- 9 (Correct answer)
- 8
- 7
Correct answer: 9
An N-gram is a contiguous sequence of N items from a given text or speech. For example, a 'bi-gram' is a 2-gram, and a 'tri-gram' is a 3-gram. The question asks for the value of N in the context of an 'N-gram', and among the given options, 9 is presented as the correct numerical value for N.
Question 2: How many bi-grams can be made out of the following sentence: "Analytics Vidhya is an excellent resource to study data science."<br> How many trigrams can be made from the following sentence using the techniques below for text cleaning:<br> Stopword Removal<br> Replacing punctuations by a single space<br> “#Analytics-vidhya is a great source to learn @data science.
- 7
- 6
- 5 (Correct answer)
- 4
Correct answer: 5
To determine the number of trigrams from the second sentence, first, the text is cleaned by replacing punctuation with spaces and removing stopwords ('is', 'a', 'to'). This results in the sequence: 'Analytics vidhya great source learn data science' (7 words). A trigram is a sequence of three consecutive words, so the number of trigrams is calculated as (number of words - 2), which is 7 - 2 = 5.
Question 3: What regular expression from the list below may be used to find the date(s) in the text object? The following data science meetup will be place on September 21 of this year; the previous one was on March 31, 2016.
- (19|20)\d{2}-(0[1-9]|1[0-2])-[0-2][1-9]
- (19|20)\d{2}-(0[1-9]|1[0-2])-([0-2][1-9]|3[0-1])
- \d{4}-\d{2}-\d{2}
- None of the above (Correct answer)
Correct answer: None of the above
The dates in the text are 'September 21' and 'March 31, 2016'. The provided regular expressions are designed to match dates in the `YYYY-MM-DD` format. Since neither of the dates in the text follows this specific format, none of the given regular expressions would successfully extract them.
Question 4: You have amassed a dataset of roughly 10,000 rows of tweet text alone. You want to develop a model for classifying tweets that divides each one into three categories: positive, negative, and neutral. Which of the following models can classify tweets in light of the aforementioned context?
- SVM
- Naive Bayes
- None of the above (Correct answer)
Correct answer: None of the above
While Support Vector Machines (SVM) and Naive Bayes are general-purpose classification algorithms often used for text, modern sentiment analysis on tweet data, especially for nuanced categories like positive, negative, and neutral, frequently leverages more advanced techniques. These often include deep learning models like Recurrent Neural Networks (RNNs) or Transformer-based models, which are better equipped to capture complex contextual patterns and semantic relationships in short, informal text like tweets. Therefore, neither SVM nor Naive Bayes might be considered the *best* or *most direct* solution in a contemporary data science context for this specific problem.
Question 5: You treated each tweet as a separate document when creating a document term matrix from the data. Which of the following statements about the document term matrix is true?<br> 1.Removal of stopwords from the data will affect the dimensionality of data<br> 2.Normalization of words in the data will reduce the dimensionality of data<br> 3.Converting all the words in lowercase will not affect the dimensionality of the data<br>
- 1 and 2 (Correct answer)
- Only 3
- Only 2
- Only 1
Correct answer: 1 and 2
Removing stopwords reduces the number of unique terms, directly lowering the dimensionality of the document-term matrix. Similarly, word normalization techniques like stemming or lemmatization consolidate different forms of a word into a single base form, which also decreases the total number of unique terms and thus the data's dimensionality. Converting words to lowercase also reduces dimensionality by treating 'Word' and 'word' as the same term, making statement 3 false.
Question 6: Which of the following features can be utilized to enhance a classification model's accuracy?
- Dependency Grammar
- Frequency count of terms
- Vector Notation of sentence
- All of these (Correct answer)
Correct answer: All of these
All listed features contribute significantly to enhancing a classification model's accuracy in text analysis. Dependency grammar provides structural insights into sentence meaning, while frequency counts of terms (like TF-IDF) capture the importance of words. Vector notation of sentences (e.g., word embeddings) represents semantic relationships, allowing models to understand context and similarity more effectively.
Question 7: What percentage of the total statements are correct with regards to Topic Modeling?<br> It is a supervised learning technique<br> LDA (Linear Discriminant Analysis) can be used to perform topic modeling<br> Selection of number of topics in a model does not depend on the size of data<br> Number of topic terms are directly proportional to size of the data\s
- 75
- 50
- 25
- 0 (Correct answer)
Correct answer: 0
All the statements provided are incorrect regarding topic modeling. Topic modeling is an unsupervised learning technique, not supervised. While Latent Dirichlet Allocation (LDA) is used for topic modeling, Linear Discriminant Analysis (also LDA) is a different algorithm. The selection of the number of topics often depends on the data's size and complexity, and the number of topic terms is not directly proportional to the overall data size.
Question 8: What do alpha and beta hyperparameters in the Latent Dirichlet Allocation model for text categorization represent?
- Alpha: number of topics within documents, beta: number of terms within topics False
- Alpha: number of topics within documents, beta: number of terms within topics False
- Alpha: density of terms generated within topics, beta: density of topics generated within terms False
- Alpha: density of topics generated within documents, beta: density of terms generated within topics True (Correct answer)
Correct answer: Alpha: density of topics generated within documents, beta: density of terms generated within topics True
In the Latent Dirichlet Allocation (LDA) model, alpha (α) is a hyperparameter that governs the document-topic distribution, specifically the density of topics generated within each document. Beta (β) is another hyperparameter that controls the topic-word distribution, determining the density of terms generated within each topic.
Question 9: What distinguishes the Conditional Random Field (CRF) from the Hidden Markov Model (HMM)?
- Both CRF and HMM are Discriminative model
- Both CRF and HMM are Generative model
- CRF is Discriminative whereas HMM is Generative model (Correct answer)
- Dictionary based learning and WCRF is Generative whereas HMM is Discriminative modelord 2 vector model
Correct answer: CRF is Discriminative whereas HMM is Generative model
The primary distinction between Conditional Random Fields (CRF) and Hidden Markov Models (HMM) lies in their modeling approach. HMMs are generative models that learn the joint probability distribution of observations and states, essentially modeling how the data is generated. In contrast, CRFs are discriminative models that directly model the conditional probability of the hidden states given the observations, focusing on learning the decision boundary for classification.
Question 10: The two most utilized methods for creating chatbots are retrieval-based models and generative models. Which of the subsequent is a retrieval model example and a generating model illustration, respectively.
- Recurrent neural network and convolutional neural network
- Word 2 vector and Sentence to Vector model
- Rule-based learning and Sequence to Sequence model (Correct answer)
- Dictionary based learning and Word 2 vector model
Correct answer: Rule-based learning and Sequence to Sequence model
Retrieval-based chatbot models select responses from a pre-existing database, and rule-based learning is a prime example where predefined rules map inputs to appropriate answers. Generative models, on the other hand, create new responses dynamically, and the Sequence-to-Sequence (Seq2Seq) model, commonly used with neural networks, is a leading illustration of this approach.
Question 11: What part does NLP play in developing the two well-known recommendation engines, collaborative filtering and content-based models?
- Measuring Feature Similarity
- Engineering Features for vector space learning model
- Feature Extraction from text
- All of these (Correct answer)
Correct answer: All of these
Natural Language Processing (NLP) plays a multifaceted role in recommendation engines. It is essential for extracting meaningful features from text data, such as item descriptions or user reviews, which are then used to engineer numerical features for vector space learning models. Furthermore, NLP enables the measurement of similarity between these features, crucial for both collaborative filtering (e.g., user profile similarity) and content-based models (e.g., item content similarity).
Question 12: When attempting to extract context from text data, you came across two different phrases: There are soldiers inside the tank. There is nitrogen in the tank. Which of the following solutions is best for solving the word sense disambiguation issue in sentences?
- Use dependency parsing of sentence to understand the meanings
- Compare the dictionary definition of an ambiguous word with the terms contained in its neighborhood (Correct answer)
- Co-reference resolution in which one resolute the meaning of ambiguous word with the proper noun present in the previous sentence
Correct answer: Compare the dictionary definition of an ambiguous word with the terms contained in its neighborhood
The most effective solution for Word Sense Disambiguation (WSD) involves analyzing the context of the ambiguous word. By comparing the dictionary definitions of the polysemous word (like 'tank') with the meanings of the words in its immediate linguistic neighborhood, one can infer the correct sense intended in that specific sentence. This contextual analysis helps distinguish between different meanings, such as a military vehicle versus a container.
Question 13: The most comprehensible type of text data is seen on social media platforms. A corpus of entire tweet social media data is provided to you. How can a model that suggests hashtags be made?
- Train a word2vector model to learn repeating contexts in the sentences
- Perform Topic Models to obtain most significant words of the corpus
- Train a Bag of Ngrams model to capture top n-grams – words and their combinations
- All of these (Correct answer)
Correct answer: All of these
To build a model that suggests hashtags from a corpus of tweet data, all the listed methods are valuable. Training a Word2Vec model helps learn semantic relationships and repeating contexts, enabling the suggestion of contextually relevant hashtags. Performing Topic Models identifies underlying themes and their most significant words, which can directly serve as hashtag candidates. Additionally, training a Bag of Ngrams model captures frequently occurring words and phrases, many of which are commonly used as hashtags.
Question 14: Which grammar-based text parsing techniques can be utilized for noun phrase detection, verb phrase detection, subject detection, and object detection when working with text data obtained from structured news sentences.
- Continuous Bag of Words
- Skip Gram and N-Gram extraction
- Part of speech tagging
- Dependency Parsing and Constituency Parsing (Correct answer)
Correct answer: Dependency Parsing and Constituency Parsing
For detecting noun phrases, verb phrases, subjects, and objects in structured news sentences, both Dependency Parsing and Constituency Parsing are highly effective grammar-based techniques. Constituency parsing builds a hierarchical tree structure that identifies grammatical constituents like noun and verb phrases. Dependency parsing, on the other hand, focuses on the grammatical relationships between words, directly identifying subjects, objects, and their modifiers.
Question 15: Did you mean, a feature of Google Search, uses a variety of methods. Which of the following methods is most likely a component?<br> 1. Collaborative Filtering model to detect similar user behaviors (queries)<br> 2. Model that checks for Levenshtein distance among the dictionary terms<br> 3. Translation of sentences into multiple languages<br>
- 1,2,3
- 1,2 (Correct answer)
- 2
- 1
Correct answer: 1,2
Google Search's 'Did you mean' feature primarily relies on two key methods. It uses collaborative filtering to identify similar user query behaviors, suggesting corrections based on what other users have searched for after typing a similar query. Additionally, it employs models that calculate the Levenshtein distance (edit distance) between the user's input and dictionary terms, effectively identifying and proposing corrections for misspelled words.
Question 16: You generated a document term matrix from the input data of 100K documents while developing a machine learning model on text data. Which of the following remedies can be used to reduce the dimensions of data –<br> 1. Latent Dirichlet Allocation<br> 2. Latent Semantic Indexing<br> 3. Keyword Normalization
- 2, 3
- only 1
- 1, 2, and 3 (Correct answer)
- 1, 3
Correct answer: 1, 2, and 3
All three listed remedies are effective for reducing the dimensionality of a document-term matrix. Latent Dirichlet Allocation (LDA) and Latent Semantic Indexing (LSI) are both topic modeling and dimensionality reduction techniques that transform high-dimensional term representations into lower-dimensional topic or semantic spaces. Keyword normalization, which includes stemming, lemmatization, and lowercasing, directly reduces the number of unique terms in the vocabulary, thereby decreasing the number of columns in the matrix.
The combination of N keywords is known as a "N-gram."