InterviewStack.io LogoInterviewStack.io

Natural Language Processing Questions

Techniques for representing and modeling human language. Covers tokenization, embeddings, text classification, sequence labeling, and language-model-based approaches, along with practical deployment and efficiency concerns for NLP systems. Emphasizes core NLP building blocks that predate and feed into generative language models.

MediumTechnical
20 practiced

Write a Python function using spaCy that accepts a list of raw user review texts and returns a cleaned tokenized representation suitable for modeling: lowercase, remove URLs and emails, normalize emojis to text tokens, remove stopwords, lemmatize, and optionally drop tokens below a frequency threshold. Show example input and output and mention dependency versions and performance considerations (use nlp.pipe for batching).

EasyTechnical
20 practiced

Explain teacher forcing when training sequence-to-sequence (seq2seq) models. Describe how it changes the training dynamics, why it is used, the discrepancy it can introduce between training and inference, and at least one mitigation strategy such as scheduled sampling.

EasyTechnical
19 practiced

You have 5,000 short free-text survey responses to 'Why did you cancel?' Provide a Python function (using regex and preprocessing) that extracts mentions of the themes: price, customer service, product bugs, and missing features. The function should be case-insensitive, tolerate punctuation, and capture common misspellings (e.g., 'prce', 'cust svc'). Include a small sample input list and expected output counts. Explain trade-offs of regex-based coding versus fuzzy matching or supervised classification.

EasyTechnical
33 practiced

Describe a simple reproducible pipeline (with brief Python pseudocode or function outlines) to extract recurring themes from 2,000 open-ended survey responses using TF-IDF + clustering (KMeans). Include preprocessing steps, vectorization choices (n-grams, stopwords), a method to choose the number of clusters, and a pragmatic approach to label clusters for business stakeholders.

MediumTechnical
20 practiced

You have 10,000 product reviews. Outline a reproducible LDA topic modeling pipeline in Python (gensim or scikit-learn): preprocessing, building dictionary/corpus, selecting number of topics, evaluating topic coherence, labeling topics for stakeholders, and integrating results into a dashboard. Include key hyperparameters to tune and evaluation heuristics.

Unlock Full Question Bank

Get access to all 12 Natural Language Processing interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.