Top NLP Interview Questions and Answers [ TO GET HIRED ]

Top NLP Interview Questions and Answers

Last updated on 09th Nov 2021, Blog, Interview Questions

About author

Vimala Raman (Python And Data Science Engineer )

Vimala Raman has over 5+ years of experience as a Python and Data Science Engineer. She provides extensive expertise in Python, Weka, and Matlab and a deep understanding of machine learning techniques and algorithms, such as k-NN, Naive Bayes, SVM, and Decision Forests.

(5.0) | 19478 Ratings 28113

Natural Language Processing (NLP) is the ability of machines to decipher and interpret human language. It’s at the heart of the tools we use every day, including translation software, chatbots, spam filters, and search engines, as well as grammar checkers, voice assistants, and social media monitoring tools. We will go over the top 100 NLP Interview questions and their detailed answers. We will cover NLP scenario-based interview questions, NLP interview questions for freshers, and NLP interview questions and answers for experienced candidates.

    Subscribe For Free Demo

    1) What do you know about NLP?


      NLP stands for Natural Language Processing. It deals with making a machine understand the way human beings read and write in a language. This task is achieved by designing algorithms that can extract meaning from large datasets in audio or text format by applying machine learning algorithms.

    2) Give examples of any two real-world applications of NLP?


    Spelling/Grammar Checking Apps:

      The mobile applications and websites that offer users correct grammar mistakes in the entered text rely on NLP algorithms. These days, they can also recommend the following few words that the user might type, which is also because of specific NLP models being used in the backend.


      Many websites now offer customer support through these virtual bots that chat with the user and resolve their problems. It acts as a filter to the issues that do not require an interaction with the companies’ customer executives.

    3) What is tokenization in NLP?


      Tokenization is the process of splitting running text into words and sentences.

    Tokenization in NLP

    4) What is the difference between a formal language and a natural language?


      Formal LanguageNatural Language
      A formal language is a collection of strings, where each string contains symbols from a finite set called alphabets.A natural language is a language that humans utilize to speak. It is usually a lot different from a formal language. These typically contain fragments of words and pause words like uh, um, etc.

    5) What is the difference between stemming and lemmatization?


      Both stemming and lemmatization are keyword normalization techniques aiming to minimize the morphological variation in the words they encounter in a sentence. But, they are different from each other in the following way.

      This technique involves removing the affixes added to a word and leaving us with the rest of the word.Lemmatization is the process of converting a word into its lemma from its inflected form.
      Example: ‘Caring’→ ’Car’ Example: ‘Caring’→ ’Care’

    6) What is NLU?


      NLU stands for Natural Language Understanding. It is a subdomain of NLP that concerns making a machine learn the skills of reading comprehension. A few applications of NLU include Machine translation (MT), Newsgathering, and Text categorization. It often goes by the name Natural Language Interpretation (NLI) as well.

    7) List the differences between NLP and NLU?


    Natural Language ProcessingNatural Language Understanding
    NLP is a branch of AI that deals with designing programs for machines that will allow them to process the language that humans use. The idea is to make machines imitate the way humans utilize language for communication.In NLU, the aim is to improve a computer’s ability to understand and analyze human language. This aim is achieved by transforming unstructured data into a machine-readable format.

    8) What do you know about Latent Semantic Indexing (LSI)?


      LSI is a technique that analyzes a set of documents to find the statistical coexistence of words that appear together. It gives an insight into the topics of those documents.

      LSI is also known as Latent Semantic Analysis.

    9) List a few methods for extracting features from a corpus for NLP.


    • 1. Bag-of-Words

    • 2. Word Embedding

    10) What are stop words?


      Stop words are the words in a document that are considered redundant by NLP engineers and are thus removed from the document before processing it. Few examples are ‘is’, ‘the’, ‘are, ‘am’.

    11) What do you know about Dependency Parsing?


      Dependency parsing is a technique that highlights the dependencies among the words of a sentence to understand its grammatical structure. It examines how the words of a sentence are linguistically linked to each other. These links are called dependencies.

    12) What is Text Summarization? Name its two types?


    • Extraction-based Summarization
    • Abstraction-based Summarization

    13) What are false positives and false negatives?


      If a machine learning algorithm falsely predicts a negative outcome as positive, then the result is labeled as a false negative.

      And, if a machine learning algorithm falsely predicts a positive outcome as negative, then the result is labeled as a false positive.

    14) List a few methods for part-of-speech tagging?


      Rule-based tagging, HMM-tagging, transformation-based tagging, and memory-based tagging.

    15) What is a corpus?


      Corpus’ is a Latin word that means ‘body.’ Thus, a body of the written or spoken text is called a corpus.

    16) List a few real-world applications of the n-gram model?


    • Augmentive Communication

    • Part-of-speech Tagging
    • Natural language generation
    • Word Similarity
    • Authorship Identification
    • Sentiment Extraction
    • Predictive Text Input

    17) What does TF*IDF stand for? Explain its significance?


      TF*IDF stands for Term-Frequency/Inverse-Document Frequency. It is an information-retrieval measure that encapsulates the semantic significance of a word in a particular document N, by degrading words that tend to appear in a variety of different documents in some huge background corpus with D documents.

      Let nw denote the frequency of a word w in the document N, m represents the total number of documents in the corpus that contain w. Then, TF*IDF is defined as


    18) What is perplexity in NLP?


      It is a metric that is used to test the performance of language models. Mathematically, it is defined as a function of the probability that the language model represents a test sample. For a test sample X = x1, x2, x3,….,xn , the perplexity is given by,


      where N is the total number of word tokens. Higher the perplexity, lesser is the information conveyed by the language model.

    19)Which algorithm in NLP supports bidirectional context?


      Naive Bayes is a classification machine learning algorithm that utilizes Baye’s Theorem for labeling a class to the input set of features. A vital element of this algorithm is that it assumes that all the feature values are independent.

    Naive Bayes Algorithm
    Naive Bayes Algorithm

    20) What is Part-of-Speech tagging?


      Part-of-speech tagging is the task of assigning a part-of-speech label to each word in a sentence. A variety of part-of-speech algorithms are available that contain tagsets having several tags between 40 and 200.

    21) What is the bigram model in NLP?


      A bigram model is a model used in NLP for predicting the probability of a word in a sentence using the conditional probability of the previous word. For calculating the conditional probability of the previous word, it is crucial that all the previous words are known.

    22) What is the significance of the Naive Bayes algorithm in NLP?


      The Naive Bayes algorithm is widely used in NLP for various applications. For example: to determine the sense of a word, to predict the tag of a given text, etc.

    23) What do you know about the Masked Language Model?


      The Masked Language Model is a model that takes a sentence with a few hidden (masked) words as input and tries to complete the sentence by correctly guessing those hidden words.

    24) What is the Bag-of-words model in NLP?


      Bag-of-words refers to an unorganized set of words. The Bag-of-words model is NLP is a model that assigns a vector to a sentence in a corpus. It first creates a dictionary of words and then produces a vector by assigning a binary variable to each word of the sentence depending on whether it exists in the bag of words or not.

    25) Briefly describe the N-gram model in NLP?


      N-gram model is a model in NLP that predicts the probability of a word in a given sentence using the conditional probability of n-1 previous words in the sentence. The basic intuition behind this algorithm is that instead of using all the previous words to predict the next word, we use only a few previous words.

    26) What do you understand by word embedding?


      In NLP, word embedding is the process of representing textual data through a real-numbered vector. This method allows words having similar meanings to have a similar representation.

    27) What is an embedding matrix?


      A word embedding matrix is a matrix that contains embedding vectors of all the words in a given text.

    28) List a few popular methods used for word embedding.


      Following are a few methods of word embedding.

    • Embedding Layer
    • Word2Vec
    • Glove

    29) How will you use Python’s concordance command in NLTK for a text that does not belong to the package?


    The concordance() function can easily be accessed for a text that belongs to the NLTK package using the following code:

    • >>>from import *
    • >>>text1.concordance(“monstrous”)

    However, for a text that does not belong to the NLTK package, one has to use the following code to access that function.

    • >>>import nltk.corpus
    • >>>from nltk.text import Text
    • >>>NLTKtext = Text(nltk.corpus.gutenberg.words(‘Your_file_name_here.txt’))
    • >>>NLTKtext.concordance(‘word’)

      Here, we have created a Text object to access the concordance() function. The function displays the occurrence of the chosen word and the context around it.

    30) Write the code to count the number of distinct tokens in a text?



    31) What are the first few steps that you will take before applying an NLP machine-learning algorithm to a given corpus?


    • Removing white spaces

    • Removing Punctuations
    • Converting Uppercase to Lowercase
    • Tokenization
    • Removing Stopwords
    • Lemmatization

    32) For correcting spelling errors in a corpus, which one is a better choice: a giant dictionary or a smaller dictionary, and why?


      Initially, a smaller dictionary is a better choice because most NLP researchers feared that a giant dictionary would contain rare words that may be similar to misspelled words. However, later it was found (Damerau and Mays (1989)) that in practice, a more extensive dictionary is better at marking rare words as errors.

    Course Curriculum

    Learn Advanced Natural Language Processing (NLP) Certification Training Course to Build Your Skills

    Weekday / Weekend BatchesSee Batch Details

    33) Do you always recommend removing punctuation marks from the corpus you’re dealing with? Why/Why not?


      No, it is not always a good idea to remove punctuation marks from the corpus as they are necessary for certain NLP applications that require the marks to be counted along with words.

      For example: Part-of-speech tagging, parsing, speech synthesis.

    34) List a few libraries that you use for NLP in Python?


      NLTK, Scikit-learn,GenSim, SpaCy, CoreNLP, TextBlob.

    35) Suggest a few machine learning/deep learning models that are used in NLP?


      Support Vector Machines, Neural Networks, Decision Tree, Bayesian Networks.

    36) Which library contains the Word2Vec model in Python?



    37) What are homographs, homophones, and homonyms?








    “onym” = name

    These are the words that have the same spelling but may or may not have the same pronunciations.These are the words that sound similar but have different spelling and different meanings.These are the words that have the same spelling and pronunciation but different meanings.
    To live a life, airing a show liveEye, IRiver Bank, Bank Account

    38) Is converting all text in uppercase to lowercase always a good idea? Explain with the help of an example?


      No, for words like The, the, THE, it is a good idea as they all will have the same meaning. However, for a word like brown which can be used as a surname for someone by the name Robert Brown, it won’t be a good idea as the word ‘brown’ has different meanings for both the cases. We, therefore, would want to treat them differently. Hence, it is better to change uppercase letters at the beginning of a sentence to lowercase, convert headings and titles to which are all in capitals to lowercase, and leave the remaining text unchanged.

    39) What is a hapax/hapax legomenon?


      The rare words that only occur once in a sample text or corpus are called hapaxes. Each one of them is called an hapax or hapax legomenon (greek for ‘read-only once’). It is also called a singleton.

    40) Is tokenizing a sentence based on white-space ‘ ‘ character sufficient? If not, give an example where it may not work.


      Tokenizing a sentence using the white space character is not always sufficient.

      Consider the example,

      “ One of our users said, ‘I love Dezyre’s content’. ”

      Tokenizing purely based on white space would result in the following words:

      ‘I said, content’.

    41) What is a collocation?


      A collocation is a group of two or more words that possess a relationship and provide a classic alternative of saying something. For example, ‘strong breeze’, ‘the rich and powerful’, ‘weapons of mass destruction.

    42) List a few types of linguistic ambiguities.


      Lexical Ambiguity: This type of ambiguity is observed because of homonyms and polysemy in a sentence.

      Syntactic Ambiguity: A syntactic ambiguity is observed when based on the sentence’s syntax, more than one meaning is possible.

      Semantic Ambiguity: This ambiguity occurs when a sentence contains ambiguous words or phrases that have ambiguous

    43) Differentiate between orthographic rules and morphological rules with respect to singular and plural forms of English words.


    Orthographiical RulesMorphological Rules
    These are the rules that contain information for extracting the plural form of English words that end in ‘y’. Such words are transformed into their plural form by converting ‘y’ into ‘i’ and adding the letters ‘es’ as suffixes.These rules contain information for words like fish; there are null plural forms. And words like goose have their plural generated by a change of the vowel.

    44) Calculate the Levenshtein distance between two sequences ‘intention’ and ‘execution’.


    Intention to Execution
    Intention to Execution

    The image above can be used to understand the number of editing steps it will take for the word intention to transform into execution.

    • The first step is deletion (d) of ‘I.’
    • The next step is to substitute (s) the letter ‘N’ with ‘E.’
    • Replace the letter ‘T’ with ‘X.’
    • The letter E remains unchanged, and the letter ‘C’ is inserted (i).
    • Substitute ‘U’ for the letter ‘N.’

    Thus, it will take five editing steps for transformations, and the Levenshtein distance is five.

    45) What are the full listing hypothesis and minimum redundancy hypothesis?


      Full Listing Hypothesis: This hypothesis suggests that all humans perceive all the words in their memory without any internal morphological structure. So, words like tire, tiring, tired are all stored separately in the mental lexicon.

      Minimum Redundancy Hypothesis:This hypothesis proposes that only the raw form of the words (morphemes) form the part of the mental lexicon. When humans process a word like tired, they recall both the morphemes (tire-d).

    46) What is sequence learning?


      Sequence learning is a method of learning where both input and output are sequences.

    47) What is NLTK?


      NLTK is a Python library, which stands for Natural Language Toolkit. We use NLTK to process data in human spoken languages. NLTK allows us to apply techniques such as parsing, tokenization, lemmatization, stemming, and more to understand natural languages. It helps in categorizing text, parsing linguistic structure, analyzing documents, etc.

    48) What is Syntactic Analysis?


      Syntactic analysis is a technique of analyzing sentences to extract meaning from it. Using syntactic analysis, a machine can analyze and understand the order of words arranged in a sentence. NLP employs grammar rules of a language that helps in the syntactic analysis of the combination and order of words in documents.

    Syntactic analysis
    Syntactic analysis

    49) What is Semantic Analysis?


      Semantic analysis helps make a machine understand the meaning of a text. It uses various algorithms for the interpretation of words in sentences. It also helps understand the structure of a sentence.

    50) List the components of Natural Language Processing?


      The major components of NLP are as follows:

    Glossary in NLP
    Glossary in NLP

    51) What is Latent Semantic Indexing (LSI)?


      Latent semantic indexing is a mathematical technique used to improve the accuracy of the information retrieval process. The design of LSI algorithms allows machines to detect the hidden (latent) correlation between semantics (words). To enhance information understanding, machines generate various concepts that associate with the words of a sentence.

      The technique used for information understanding is called singular value decomposition. It is generally used to handle static and unstructured data. The matrix obtained for singular value decomposition contains rows for words and columns for documents. This method best suits to identify components and group them according to their types.

      The main principle behind LSI is that words carry a similar meaning when used in a similar context. Computational LSI models are slow in comparison to other models. However, they are good at contextual awareness that helps improve the analysis and understanding of a text or a document.

    52) What is Regular Grammar?


      Regular grammar is used to represent a regular language:

      A regular grammar comprises rules in the form of A -> a, A -> aB, and many more. The rules help detect and analyze strings by automated computation.

      Regular grammar consists of four tuples:

    • ‘N’ is used to represent the non-terminal set.
    • ‘∑’ represents the set of terminals.
    • ‘P’ stands for the set of productions.
    • ‘S € N’ denotes the start of non-terminal.

    53) What is Parsing in the context of NLP?


      Parsing in NLP refers to the understanding of a sentence and its grammatical structure by a machine. Parsing allows the machine to understand the meaning of a word in a sentence and the grouping of words, phrases, nouns, subjects, and objects in a sentence. Parsing helps analyze the text or the document to extract useful insights from it. To understand parsing, refer to the below diagram:

    Parsing context in the NLP
    Parsing context in the NLP

    54) Define the terminology in NLP?


      This is one of the most often asked NLP interview questions.

      The interpretation of Natural Language Processing depends on various factors, and they are:

    Terminology in NLP
    Terminology in NLP

    55) Explain Dependency Parsing in NLP?


      Dependency parsing helps assign a syntactic structure to a sentence. Therefore, it is also called syntactic parsing. Dependency parsing is one of the critical tasks in NLP. It allows the analysis of a sentence using parsing algorithms. Also, by using the parse tree in dependency parsing, we can check the grammar and analyze the semantic structure of a sentence.

    Dependency in NLP
    Dependency in NLP

    56) What is the difference between NLP and NLU?


      The below table shows the difference between NLP and NLU:

    NLP Vs NLU

    57) What is Pragmatic Analysis?


      Pragmatic analysis is an important task in NLP for interpreting knowledge that is lying outside a given document. The aim of implementing pragmatic analysis is to focus on exploring a different aspect of the document or text in a language. This requires a comprehensive knowledge of the real world. The pragmatic analysis allows software applications for the critical interpretation of the real-world data to know the actual meaning of sentences and words.


      Consider this sentence: ‘Do you know what time it is?’

      This sentence can either be asked for knowing the time or for yelling at someone to make them note the time. This depends on the context in which we use the sentence.

    58) What are unigrams, bigrams, trigrams, and n-grams in NLP?


      When we parse a sentence one word at a time, then it is called a unigram. The sentence parsed two words at a time is a bigram.

      When the sentence is parsed three words at a time, then it is a trigram. Similarly, n-gram refers to the parsing of n words at a time.

      Example: To understand unigrams, bigrams, and trigrams, you can refer to the below diagram:

    unigrams, bigrams, trigrams, and n-grams in NLP
    Unigrams, Bigrams, Trigrams, and n-grams in NLP

      Therefore, parsing allows machines to understand the individual meaning of a word in a sentence. Also, this type of parsing helps predict the next word and correct spelling errors.

    59) What are the steps involved in solving an NLP problem?


      Below are the steps involved in solving an NLP problem:

    • Gather the text from the available dataset or by web scraping
    • Apply stemming and lemmatization for text cleaning
    • Apply feature engineering techniques
    • Embed using word2vec
    • Train the built model using neural networks or other Machine Learning techniques
    • Evaluate the model’s performance
    • Make appropriate changes in the model
    • Deploy the model

    60) What is Feature Extraction in NLP?


      Features or characteristics of a word help in text or document analysis. They also help in sentiment analysis of a text. Feature extraction is one of the techniques that are used by recommendation systems. Reviews such as ‘excellent,’ ‘good,’ or ‘great’ for a movie are positive reviews, recognized by a recommender system. The recommender system also tries to identify the features of the text that help in describing the context of a word or a sentence. Then, it makes a group or category of the words that have some common characteristics. Now, whenever a new word arrives, the system categorizes it as per the labels of such groups.

    61) What is precision and recall?


      The metrics used to test an NLP model are precision, recall, and F1. Also, we use accuracy for evaluating the model’s performance. The ratio of prediction and the desired output yields the accuracy of the model.

      Precision is the ratio of true positive instances and the total number of positively predicted instances.

    Precision in NLP
    Precision in NLP

    62) What is F1 score in NLP?


      F1 score evaluates the weighted average of recall and precision. It considers both false negative and false positive instances while evaluating the model. F1 score is more accountable than accuracy for an NLP model when there is an uneven distribution of class. Let us look at the formula for calculating F1 score:

    Precision in NLP
    Precision in NLP

    63) How to tokenize a sentence using the nltk package?


      Tokenization is a process used in NLP to split a sentence into tokens. Sentence tokenization refers to splitting a text or paragraph into sentences.

      For tokenizing, we will import sent_tokenize from the nltk package:

        from nltk.tokenize import sent_tokenize<>

      We will use the below paragraph for sentence tokenization:

      Para = “Hi Guys. Welcome to ACTE. This is a blog on the NLP interview questions and answers.”

    • [ ‘Hi Guys.’ ,
    • ‘Welcome to ACTE. ‘,
    • ‘This is a blog on the NLP interview questions and answers. ‘ ]

      Tokenizing a word refers to splitting a sentence into words.

      Now, to tokenize a word, we will import word_tokenize from the nltk package.

      from nltk.tokenize import word_tokenize

    Para = “Hi Guys. Welcome to ACTE. This is a blog on the NLP interview questions and answers.”

      [ ‘Hi’ , ‘Guys’ , ‘ . ‘ , ‘Welcome’ , ‘to’ , ‘ ACTE’ , ‘ . ‘ , ‘This’ , ‘is’ ,

    64) Explain how we can do parsing?


      Parsing is the method to identify and understand the syntactic structure of a text. It is done by analyzing the individual elements of the text. The machine parses the text one word at a time, then two at a time, further three, and so on.

    • When the machine parses the text one word at a time, then it is a unigram.
    • When the text is parsed two words at a time, it is a bigram.
    • The set of words is a trigram when the machine parses three words at a time.
    Parsing in NLP
    Parsing in NLP

    65) Explain Stemming with the help of an example?


      In Natural Language Processing, stemming is the method to extract the root word by removing suffixes and prefixes from a word.

      For example, we can reduce ‘stemming’ to ‘stem’ by removing ‘m’ and ‘ing.’

      We use various algorithms for implementing stemming, and one of them is PorterStemmer.

      First, we will import PorterStemmer from the nltk package.

      from nltk.stem import PorterStemmer

      Creating an object for PorterStemmer

    • pst=PorterStemmer()
    • pst.stem(“running”), pst.stem(“cookies”), pst.stem(“flying”)
      (‘run’, ‘cooki’, ‘fly’ )

    66) Explain Lemmatization with the help of an example?


      We use stemming and lemmatization to extract root words. However, stemming may not give the actual word, whereas lemmatization generates a meaningful word.

      In lemmatization, rather than just removing the suffix and the prefix, the process

      tries to find out the root word with its proper meaning.

      Example: ‘Bricks’ becomes ‘brick,’ ‘corpora’ becomes ‘corpus,’ etc.

      Let’s implement lemmatization with the help of some nltk packages.

      First, we will import the required packages.

      • from nltk.stem import wordnet
      • from nltk.stem import WordnetLemmatizer

      Creating an object for WordnetLemmatizer()

      • lemma= WordnetLemmatizer()
      • list = [“Dogs”, “Corpora”, “Studies”]
      • for n in list:
      • print(n + “:” + lemma.lemmatize(n))
      • Dogs: Dog
      • Corpora: Corpus
      • Studies: Study

    67)Explain Named Entity Recognition by implementing it?


      Named Entity Recognition (NER) is an information retrieval process. NER helps classify named entities such as monetary figures, location, things, people, time, and more. It allows the software to analyze and understand the meaning of the text. NER is mostly used in NLP, Artificial Intelligence, and Machine Learning. One of the real-life applications of NER is chatbots used for customer support. Let’s implement NER using the spacy package.

      Importing the spacy package:

    • import spacy
    • nlp = spacy.load(‘en_core_web_sm’)
    • Text = “The head office of Google is in California”
    • document = nlp(text)for ent in document.ents:
    • print(ent.text, ent.start_char, ent.end_char, ent.label_)
    • Office 9 15 Place
    • Google 19 25 ORG
    • California 32 41 GPE

    68) How to check word similarity using the spacy package?


      To find out the similarity among words, we use word similarity. We evaluate the similarity with the help of a number that lies between 0 and 1. We use the spacy library to implement the technique of word similarity.

    • import spacy
    • nlp = spacy.load(‘en_core_web_md’)
    • print(“Enter the words”)
    • input_words = input()
    • tokens = nlp(input_words)
    • for i in tokens:
    • print(i.text, i.has_vector, i.vector_norm, i.is_oov)
    • token_1, token_2 = tokens[0], tokens[1]
    • print(“Similarity between words:”, token_1.similarity(token_2))
    • hot True 5.6898586 False
    • cold True6.5396233 False
    • Similarity: 0.597265

    Course Curriculum

    Get JOB Oriented Natural Language Processing (NLP) Training for Beginners By MNC Experts

    • Instructor-led Sessions
    • Real-life Case Studies
    • Assignments
    Explore Curriculum

    69) List some open-source libraries for NLP?


      The popular libraries are NLTK (Natural Language ToolKit), SciKit Learn, Textblob, CoreNLP, spaCY, Gensim.

    Open-source libraries for NLP
    Open-source libraries for NLP

    70) Explain the masked language model?


      Masked modeling is an example of autoencoding language modeling. Here the output is predicted from corrupted input. By this model, we can predict the word from other words present in the sentences.

    71)What is the bag of words model?


      The Bagofwords model is used for information retrieval. Here the text is represented as a multiset, i.e., a bag of words. We don’t consider grammar and word order, but we surely maintain the multiplicity:

    Bagofwords model
    Bag of words model

    72) What are the features of the text corpus in NLP?


      The features of text corpus are:

    • Word count
    • Vector notation
    • Part of speech tag
    • Boolean feature
    • Dependency grammar

    73) What is named entity recognition (NER)?


      Named Entity Recognition is a part of information retrieval, a method to locate and classify the entities present in the unstructured data provided and convert them into predefined categories.

    74)What is an NLP pipeline, and what does it consist of?


      Generally, NLP problems can be solved by navigating the following steps (referred as a pipeline):

    • Gathering text, whether it’s from web scraping or the use of available datasets
    • Cleaning text (through the processes of stemming and lemmatization)
    • Representation of the text (bag-of-words method)
    • Word embedding and sentence representation (Word2Vec, SkipGram model)
    • Training the model (via neural nets or regression techniques)
    • Evaluating the model
    • Adjusting the model, as needed
    • Deploying the model

    75) What is a “stop” word?


      Articles such as “the” or “an,” and other filler words that bind sentences together (e.g., “how,” “why,” and “is”) but don’t offer much additional meaning are often referred to as “stop” words. In order to get to the root of a search and deliver the most relevant results, search engines routinely filter out stop words.

    76) What is “term frequency-inverse document frequency?


      Term frequency-inverse document frequency (TF-IDF) is an indicator of how important a given word is in a document, which helps identify key words and assist with the process of feature extraction for categorization purposes. While “TF” identifies how frequently a given word or phrase (“W”) is used, “IDF” measures its importance within the document. The formulas to answer this NLP interview question are as follows:

      TF(W) = Frequency of W in a document / Total number of terms in the document
    IDF(W) = log_e (Total number of documents / Number of documents having the term W)

      Using these formulas, you can determine just how important a given word or phrase is within a document. If the TF-IDF is high, then the frequency of that term is lower; if the TF-IDF is low, then its frequency is higher. Search engines use this to help them rank sites.

    77) What is perplexity? What is its place in NLP?


      Perplexity is a way to express a degree of confusion a model has in predicting. More entropy = more confusion. Perplexity is used to evaluate language models in NLP. A good language model assigns a higher probability to the right prediction.

    78) What is the problem with ReLu?


    • Exploding gradient(Solved by gradient clipping)
    • Dying ReLu — No learning if the activation is 0 (Solved by parametric relu)
    • Mean and variance of activations is not 0 and 1.(Partially solved by subtracting around 0.5 from activation. Better explained in fastai videos)

    79) What is the difference between learning latent features using SVD and getting embedding vectors using deep network?


      SVD uses linear combination of inputs while a neural network uses non-linear combination.

    80) What are the different types of attention mechanism?


    Attention Mechanism in NLP
    Attention Mechanism in NLP

    81) Why does the transformer block have LayerNorm instead of BatchNorm?


    LayerNorm instead of BatchNorm
    LayerNorm instead of BatchNorm

    82) What are the tricks used in ULMFiT? (Not a great questions but checks the awareness)


    • LM tuning with task text
    • Weight dropout
    • Discriminative learning rates for layers
    • Gradual unfreezing of layers
    • Slanted triangular learning rate schedule

    83) What are the differences between GPT and BERT?


    GPT and BERT
    GPT and BERT

    • GPT is not bidirectional and has no concept of masking
    • BERT adds next sentence prediction task in training and so it also has a segment embedding

    84) Given this chart, will you go with a transformer model or LSTM language model?


    LSTM language model
    LSTM language model

    85) What is Language modeling ?


      A statistical language model is a probability distribution over sequences of words. Given such a sequence, say of length m, it assigns a probability to the whole sequence. The language model provides context to distinguish between words and phrases that sound simila

    86) What is Latent semantic analysis ?


      Latent semantic analysis is a technique in natural language processing, in particular distributional semantics, of analyzing relationships between a set of documents and the terms they contain by producing a set of concepts related to the documents and terms

    87) What is Fasttext?


      FastText is a library for learning of word embeddings and text classification created by Facebook’s AI Research lab. The model allows to create an unsupervised learning or supervised learning algorithm for obtaining vector representations for words

    88) Explain parts of speech tagging (POS tagging)?



    • import nltk
    • from nltk.corpus import stopwords
    • from nltk.tokenize import word_tokenize, sent_tokenize
    • stop_words = set (stopwords.Words(‘english’))
    • txt = “A, B, C are longtime classmates.”
    • ## Tokenized via sent_tokenize
    • tokenized_text = sent_tokenize (txt)/li>
    • ## Using word_tokenizer to identify a string’s words and punctuation then removing stop words
    • for n in tokenized_text:
    • wordsList = nltk.word_tokenize(i)
    • wordsList = [w for w in wordsList if not w in stop_words]
    • ## Using POS tagger
    • tagged_words = nltk.pos_tag(wordsList)
    • print (tagged_words)


    • [(‘A’, ‘NNP’), (‘B’, ‘NNP’), (‘C’, ‘NNP’), (‘longtime’, ‘JJ’), (‘classmates’, ‘NNS’)]

    89) Define and implement named entity recognition?


      For retrieving information and identifying entities present in the data for instance location, time, figures, things, objects, individuals, etc. NER (named entity recognition) is used in AI, NLP, machine learning, implemented for making the software understand what the text means. Chatbots are a real-life example that makes use of NER.

    • import spacy
    • nlp = spacy.load(‘en_core_web_sm’)
    • Text = “The head office of Tesla is in California”
    • document = nlp(text)
    • for ent in document.ents:
    • print(ent.text, ent.start_char, ent.end_char, ent.label_)
    • Office 9 15 Place
    • Tesla 19 25 ORG
    • California 32 41 GPE

    90) What is the significance of TF-IDF?


      tf–idf or TFIDF stands for term frequency–inverse document frequency. In information retrieval TFIDF is is a numerical statistic that is intended to reflect how important a word is to a document in a collection or in the collection of a set.

    91) What is Named Entity Recognition(NER)?


      Named entity recognition is a method to divide a sentence into categories. Neil Armstrong of the US had landed on the moon in 1969 will be categorized as Neil Armstrong- name; The US – country;1969 – time(temporal token).

      The idea behind NER is to enable the machine to pull out entities like people, places, things, locations, monetary figures, and more.

    92) Explain briefly about word2vec?


      Word2Vec embeds words in a lower-dimensional vector space using a shallow neural network. The result is a set of word-vectors where vectors close together in vector space have similar meanings based on context, and word-vectors distant to each other have differing meanings.

      For example, apple and orange would be close together and apple and gravity would be relatively far. There are two versions of this model based on skip-grams (SG) and continuous-bag-of-words (CBOW).

    93) What are the 5 steps in NLP?


      The five phases of NLP involve lexical (structure) analysis, parsing, semantic analysis, discourse integration, and pragmatic analysis. Some well-known application areas of NLP are Optical Character Recognition (OCR), Speech Recognition, Machine Translation, and Chatbots.

    94) What is the main challenges of NLP?


      There are enormous ambiguity exists when processing natural language. 4. Modern NLP algorithms are based on machine learning, especially statistical machine learning.

    95) Which NLP model gives the best accuracy amongst the following?


      Naive Bayes is the most precise model, with a precision of 88.35%, whereas Decision Trees have a precision of 66%.

    96) How many components of NLP are there?


      Five main Component of Natural Language processing in AI are: Morphological and Lexical Analysis. Syntactic Analysis. Semantic Analysis.

    97) What is NLP example?


      Email filters are one of the most basic and initial applications of NLP online. It started out with spam filters, uncovering certain words or phrases that signal a spam message. The system recognizes if emails belong in one of three categories (primary, social, or promotions) based on their contents.

    98) Who uses NLP?


      Interest in NLP grew in the late 1970s, after Bandler and Grinder began marketing the approach as a tool for people to learn how others achieve success. Today, NLP is used in a wide variety of fields, including counseling, medicine, law, business, the performing arts, sports, the military, and education.

    Python Sample Resumes! Download & Edit, Get Noticed by Top Employers! Download

    99)Why is neurolinguistics important?


      Neurolinguistics is important because it studies the mechanisms in the brain that control acquisition, comprehension, and production of language.

    Are you looking training with Right Jobs?

    Contact Us

    Popular Courses

    Get Training Quote for Free