1. Home
  2. Explore
  3. Computer Science
  4. Natural Language Processing

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Natural Language Processing

  • 85Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: NLP Foundations

What is natural language processing?

85 questions

  1. 1

    What is natural language processing?

    Model answer

    Natural language processing is the field of getting computers to work with and understand human languages such as English.

    Explanation

    It addresses the challenge of interpreting and generating natural language, which contains substantial nuance and complexity.

  2. 2

    What is automatic summarization?

    Model answer

    Automatic summarization is the task of producing a shorter representation of a longer text.

    Explanation

    The computer identifies and presents the essential content of the original text in a more concise form.

  3. 3

    What is information extraction?

    Model answer

    Information extraction is the process of pulling relevant facts or details from text.

    Explanation

    The goal is to identify useful information within a larger body of natural language.

  4. 4

    What is machine translation?

    Model answer

    Machine translation is the use of computers to translate text from one natural language into another.

    Explanation

    Examples include translating English text into French or using services such as Google Translate.

  5. 5

    What is question answering in natural language processing?

    Model answer

    Question answering is the task of understanding a text-based question and generating an appropriate textual response.

    Explanation

    AI chatbots and voice assistants perform this task by interpreting user input and producing an answer.

  6. 6

    What is text classification? Give two examples.

    Model answer

    Text classification assigns text to a category or label; examples include classifying email as inbox or spam and reviews as positive or negative.

    Explanation

    The computer analyzes an input text and selects one of the predefined categories.

  7. 7

    What is syntax, and why is it important for NLP?

    Model answer

    Syntax concerns the structure and arrangement of words in language. NLP systems need syntax to determine whether words form a well-structured sentence and how they relate to one another.

    Explanation

    The same words can form a valid or invalid sentence depending on their arrangement.

  8. 8

    What is semantics, and how does it differ from syntax?

    Model answer

    Semantics concerns the meaning of words and sentences, whereas syntax concerns their structure.

    Explanation

    A sentence can be structurally valid without having a meaningful interpretation.

  9. 9

    Why is the sentence “I saw the man on the mountain with a telescope” ambiguous?

    Model answer

    It can mean that the observer used the telescope or that the man on the mountain had the telescope.

    Explanation

    The sentence has multiple valid syntactic structures, producing different interpretations.

  10. 10

    Why does “Colorless green ideas sleep furiously” illustrate a challenge in language understanding?

    Model answer

    It is syntactically well-formed but lacks a meaningful overall interpretation.

    Explanation

    Correct grammatical structure does not guarantee semantic coherence.

  11. 11

    What is a formal grammar?

    Model answer

    A formal grammar is a system of rules for generating sentences in a language.

    Explanation

    A rule-based NLP system can use these rules to analyze or produce sentence structures.

  12. 12

    What is a context-free grammar?

    Model answer

    A context-free grammar is a formal grammar in which rewriting rules describe how nonterminal symbols can be replaced by other symbols.

    Explanation

    It can represent sentence structure by defining relationships among symbols such as sentences, noun phrases, and verb phrases.

  13. 13

    What is the difference between terminal and nonterminal symbols in a context-free grammar?

    Model answer

    Terminal symbols are final words produced by the grammar, while nonterminal symbols are categories that can be rewritten into terminals or other nonterminals.

    Explanation

    For example, “city” is a terminal, while N for noun and NP for noun phrase are nonterminals.

  14. 14

    What do the nonterminal symbols N, V, and D represent?

    Model answer

    N represents a noun, V represents a verb, and D represents a determiner.

    Explanation

    Determiners include words such as “the,” “a,” and “an.”

  15. 15

    What is a rewriting rule in a context-free grammar?

    Model answer

    A rewriting rule specifies what symbols a nonterminal can be replaced with.

    Explanation

    For example, a noun rule can allow N to become “she,” “city,” “car,” or “Harry.”

  16. 16

    How can a noun phrase be defined in a simple context-free grammar?

    Model answer

    A noun phrase can be defined as either a noun or a determiner followed by a noun.

    Explanation

    This allows noun phrases such as “she” and “the city.”

  17. 17

    How can a verb phrase be defined in a simple context-free grammar?

    Model answer

    A verb phrase can be defined as either a verb or a verb followed by a noun phrase.

    Explanation

    This allows verb phrases such as “walked” and “saw the city.”

  18. 18

    How can a sentence be defined using noun phrases and verb phrases?

    Model answer

    A sentence can be defined as a noun phrase followed by a verb phrase.

    Explanation

    Under this rule, “she saw the city” consists of the noun phrase “she” and the verb phrase “saw the city.”

  19. 19

    What is NLTK, and how can it be used with a context-free grammar?

    Model answer

    NLTK, or the Natural Language Toolkit, is a Python library that provides tools for processing natural language, including parsing context-free grammars.

    Explanation

    An NLTK parser can analyze an input sentence and produce a syntax tree.

  20. 20

    What does a syntax tree represent?

    Model answer

    A syntax tree represents the hierarchical structure of a sentence by showing how words form phrases and how phrases form the complete sentence.

    Explanation

    For example, it can show that “saw the city” is a verb phrase containing a noun phrase.

  21. 21

    Why can a context-free grammar produce multiple parse trees for one sentence?

    Model answer

    A sentence can have more than one valid syntactic structure, with each structure corresponding to a different interpretation.

    Explanation

    For example, “she saw the dog with the binoculars” can associate the binoculars with the observer or with the dog.

  22. 22

    What is an n-gram?

    Model answer

    An n-gram is a contiguous sequence of nnn items from a text, such as characters or words.

    Explanation

    When the items are words, an n-gram captures neighboring word sequences.

  23. 23

    What is a bigram and what is a trigram?

    Model answer

    A bigram is an n-gram containing two words, while a trigram contains three words.

    Explanation

    Examples of trigrams include “how often have” and “often have I.”

  24. 24

    How can a corpus of n-grams provide information about language?

    Model answer

    Counting n-grams in a large corpus reveals which word sequences commonly occur next to one another.

    Explanation

    Frequent sequences provide statistical evidence about patterns in natural language.

  25. 25

    What is tokenization?

    Model answer

    Tokenization is the process of splitting a sequence of characters into smaller pieces, such as individual words.

    Explanation

    After tokenization, sequences of tokens can be used to construct and analyze n-grams.

  26. 26

    How can NLTK and a counter be used to analyze n-grams?

    Model answer

    NLTK can extract n-grams from a text corpus, and a counter can identify the most frequent n-grams.

    Explanation

    This makes it possible to determine which two-word or three-word sequences occur most often.

  27. 27

    What is a Markov chain in the context of language generation?

    Model answer

    It is a model that predicts the next word based on preceding words or sequences of words.

    Explanation

    Word-sequence statistics from a corpus can be used to estimate which word is likely to follow a given context.

  28. 28

    How can a Markov model generate new text?

    Model answer

    It repeatedly predicts a likely next word using patterns learned from a text corpus until a sequence is produced.

    Explanation

    The generated text may not appear in the original corpus but can follow its statistical word patterns.

  29. 29

    What is a limitation of text generated only from n-gram or Markov statistics?

    Model answer

    The generated text may follow common word patterns without being meaningful or semantically coherent.

    Explanation

    Statistical plausibility alone does not guarantee that the complete sentence makes sense.

  30. 30

    Why is writing a complete rule-based grammar difficult?

    Model answer

    Natural language contains many complex rules and possible constructions, so covering every sentence a speaker might produce requires substantial effort.

    Explanation

    This motivates statistical and machine-learning approaches that learn patterns from data.

  31. 31

    What is text classification, and what is sentiment analysis?

    Model answer

    Text classification assigns text to a category, while sentiment analysis classifies its emotional evaluation, commonly as positive or negative.

    Explanation

    Email filtering and product-review analysis are examples of these tasks.

  32. 32

    How can words help a computer classify product-review sentiment?

    Model answer

    Words such as “loved,” “fun,” and “best” tend to indicate positive sentiment, while “broke,” “cheap,” and “flimsy” tend to indicate negative sentiment.

    Explanation

    A classifier can learn associations between particular words and sentiment labels from labeled examples.

  33. 33

    What is the bag-of-words model?

    Model answer

    The bag-of-words model represents text as an unordered collection of its words, ignoring their sequence.

    Explanation

    This simplifies analysis but loses information about word order and relationships between words.

  34. 34

    What is a Naive Bayes classifier?

    Model answer

    A Naive Bayes classifier classifies text using Bayes’ rule while assuming that the words are conditionally independent given the class.

    Explanation

    The independence assumption is often unrealistic, but it simplifies calculation and can still produce useful results.

  35. 35

    What does the “naive” assumption mean in Naive Bayes?

    Model answer

    It means assuming that the words in a message are independent of one another once the message’s class is known.

    Explanation

    For example, the presence of “grandson” is assumed not to change the probability of “loved,” apart from their shared dependence on sentiment.

  36. 36

    How is Bayes’ rule used to classify a review?

    Model answer

    The classifier compares the probability of the review’s words given each possible class, multiplied by the prior probability of that class.

    Explanation

    The class with the larger resulting probability is favored after the values are normalized.

  37. 37

    How is the prior probability of a sentiment class estimated from training data?

    Model answer

    It is estimated by dividing the number of training reviews in that class by the total number of training reviews.

    Explanation

    For example, the proportion of positive reviews estimates the prior probability of positive sentiment.

  38. 38

    How is the conditional probability of a word given a sentiment class estimated?

    Model answer

    It is estimated by dividing the number of reviews in that class containing the word by the total number of reviews in that class.

    Explanation

    This provides the word likelihood used in the Naive Bayes calculation.

  39. 39

    Why can a word unseen in one class cause a problem for Naive Bayes?

    Model answer

    If a word has never appeared in a class, its estimated conditional probability is zero, causing the entire product for that class to become zero.

    Explanation

    This can incorrectly eliminate a class merely because the training data was limited.

  40. 40

    What is additive smoothing?

    Model answer

    Additive smoothing adds a small value to observed counts or probabilities so that unseen events do not receive zero probability.

    Explanation

    It reduces the impact of sparse training data.

  41. 41

    What is Laplace smoothing?

    Model answer

    Laplace smoothing is a form of additive smoothing that adds 111 to each count, effectively pretending every possible event has been observed once.

    Explanation

    This prevents a zero probability from causing the Naive Bayes product to become zero.

  42. 42

    Why must the positive and negative Naive Bayes scores be normalized?

    Model answer

    The unnormalized scores are proportional values rather than a probability distribution, so they must be scaled to sum to 111.

    Explanation

    Normalization converts the class scores into interpretable probabilities.

  43. 43

    What is a one-hot representation of a word?

    Model answer

    A one-hot representation is a vector with one 111 and zeros in every other position, with each word assigned a distinct position.

    Explanation

    For example, different words can be represented by placing the 111 in different coordinates.

  44. 44

    Why are one-hot vectors inefficient for large vocabularies?

    Model answer

    They require a separate coordinate for every vocabulary word, producing very long vectors when the vocabulary is large.

    Explanation

    Long vectors are more difficult to store, process, and train with.

  45. 45

    Why do one-hot representations fail to capture word similarity?

    Model answer

    Words with similar meanings still receive completely different vectors because their 111s occur in different positions.

    Explanation

    For example, “wrote” and “authored” are semantically similar but have unrelated one-hot representations.

  46. 46

    What is a distributed representation?

    Model answer

    A distributed representation represents a word’s meaning across multiple numerical values in a vector.

    Explanation

    It can place words with similar meanings near one another in a vector space.

  47. 47

    What principle motivates representing word meaning through surrounding words?

    Model answer

    The principle is that a word can be understood by the company it keeps, meaning by the words that commonly appear around it.

    Explanation

    Words appearing in similar contexts are treated as having related meanings.

  48. 48

    Why might “breakfast,” “lunch,” and “dinner” receive similar vector representations?

    Model answer

    They can occur in similar contexts, such as the phrase “for ___ he ate,” suggesting that they have related meanings.

    Explanation

    Contextual similarity provides evidence of semantic similarity.

  49. 49

    What is the word2vec model?

    Model answer

    word2vec is a model that learns vector representations of words from the contexts in which they appear.

    Explanation

    During training, words used in similar contexts are moved toward similar positions in vector space.

  50. 50

    How can distance between word vectors be used?

    Model answer

    Vector distance can estimate semantic similarity: smaller distances indicate that words have more similar meanings.

    Explanation

    For example, “book” should be closer to “novel” than to “breakfast.”

  51. 51

    What does finding the closest word vectors to “book” reveal?

    Model answer

    It identifies words such as “books,” “essay,” “memoir,” and “novella” that have similar learned representations.

    Explanation

    These nearby vectors suggest that word2vec has captured related meanings or usage patterns.

  52. 52

    How can word2vec represent relationships between words?

    Model answer

    Vector differences can represent relationships, so applying the relationship from “man” to “king” to “woman” can produce “queen.”

    Explanation

    The approximate relationship is represented by adding the vector difference king−manking - manking−man to the vector for “woman.”

  53. 53

    Why are numerical word representations useful for neural networks?

    Model answer

    Neural networks require numerical inputs and outputs, so word vectors allow language data to be processed by these models.

    Explanation

    Once words are represented as vectors, a neural network can learn patterns connecting language inputs and outputs.

  54. 54

    What is the sequence-to-sequence problem in natural language processing?

    Model answer

    It is the problem of transforming a variable-length input sequence, such as a question or sentence, into a variable-length output sequence.

    Explanation

    Machine translation and question answering both require sequence-to-sequence processing.

  55. 55

    Why is translating an entire sentence more difficult than translating one word?

    Model answer

    A sentence has variable length and requires preserving relationships and meaning across a sequence rather than mapping one fixed-size input to one output.

    Explanation

    A neural network must handle both shorter and longer inputs while generating an appropriate sequence.

  56. 56

    What is a recurrent neural network?

    Model answer

    A recurrent neural network processes a sequence one element at a time while passing a hidden state from one step to the next.

    Explanation

    The hidden state carries relevant information from earlier parts of the sequence.

  57. 57

    What is the purpose of the hidden state in a recurrent neural network?

    Model answer

    The hidden state stores information from previous inputs so that later processing steps can use the earlier context.

    Explanation

    This allows the network to account for the order and history of a sequence.

  58. 58

    What is an encoder-decoder architecture?

    Model answer

    An encoder-decoder architecture encodes an input sequence into a hidden representation and then decodes that representation into an output sequence.

    Explanation

    It can be used for tasks such as translating a question into an answer or translating between languages.

  59. 59

    How does an encoder process an input sequence?

    Model answer

    It processes each input word in order, updating a hidden state that summarizes the information seen so far.

    Explanation

    After the final input and an end signal, the resulting state is passed to the decoding process.

  60. 60

    How does a decoder generate an output sequence?

    Model answer

    The decoder uses the encoded state and previously generated output words to predict the next output word one step at a time.

    Explanation

    It continues generating tokens until it produces a special end token.

  61. 61

    Why are special start or end tokens used in sequence generation?

    Model answer

    They signal when a sequence begins or ends, allowing the model to start decoding and recognize when generation is complete.

    Explanation

    An end token tells the decoder that no additional output words are needed.

  62. 62

    What is the main limitation of encoding a long sequence into one hidden state?

    Model answer

    A single hidden state must store all information needed from the input, which becomes increasingly difficult as the sequence grows.

    Explanation

    Important details can be difficult to preserve in one fixed context representation.

  63. 63

    What is the purpose of the attention mechanism?

    Model answer

    Attention allows the model to determine which input representations are most relevant when generating a particular output word.

    Explanation

    Different output words can focus on different parts of the input sequence.

  64. 64

    How are attention scores used to construct a context vector?

    Model answer

    The model weights each input hidden-state vector by its attention score and combines them into a weighted context vector.

    Explanation

    The resulting vector emphasizes the input information most relevant to the current output step.

  65. 65

    Why might the words “capital” and “Massachusetts” receive high attention when generating “Boston”?

    Model answer

    They provide the most relevant information for determining the answer to the question about Massachusetts’s capital.

    Explanation

    Attention focuses the decoder on input words that help predict the next output token.

  66. 66

    How can attention scores be calculated?

    Model answer

    They can be calculated using a similarity measure such as a dot product or by using a learned neural network.

    Explanation

    During training, the model learns how to assign scores that improve output prediction.

  67. 67

    How did attention improve machine translation?

    Model answer

    It allowed the model to focus on the relevant source-language words when generating each target-language word.

    Explanation

    Attention visualizations often show strong correspondence between translated words in the two languages.

  68. 68

    Why can attention focus on multiple input words for one output word?

    Model answer

    The meaning of an output word may depend on several source words, so the model can assign substantial scores to multiple inputs.

    Explanation

    For example, a translated word may depend on both an adjective and the noun it modifies.

  69. 69

    Why are recurrent neural networks difficult to parallelize?

    Model answer

    Each processing step depends on the hidden state produced by the previous step, so the steps must occur sequentially.

    Explanation

    This sequential dependency makes training and processing slower for long sequences.

  70. 70

    What problem motivated the development of Transformer architectures?

    Model answer

    Transformers were motivated partly by the difficulty of parallelizing recurrent networks and the increasing cost of training on large language datasets.

    Explanation

    Transformers process sequence information in a way that supports much greater parallelism.

  71. 71

    How does a Transformer encoder differ from a recurrent encoder in processing input words?

    Model answer

    A Transformer can process input words independently and in parallel rather than waiting for previous recurrent steps.

    Explanation

    Parallel processing improves training efficiency, especially for long sequences.

  72. 72

    What information is lost if a Transformer processes words independently without an additional mechanism?

    Model answer

    The model loses information about the order or position of the words.

    Explanation

    Word order can change meaning, as shown by reversing the subjects and recipients in a sentence.

  73. 73

    What is positional encoding?

    Model answer

    Positional encoding is a vector representing a word’s position in a sequence.

    Explanation

    Adding it to a word representation allows the model to use both the word’s identity and its location.

  74. 74

    What is self-attention in a Transformer encoder?

    Model answer

    Self-attention allows each input word to consider other input words when forming its encoded representation.

    Explanation

    Because word meaning depends on context, this produces representations that reflect the surrounding sentence.

  75. 75

    What is multi-headed attention?

    Model answer

    Multi-headed attention uses multiple attention mechanisms simultaneously so the model can focus on different aspects of the input.

    Explanation

    Different attention heads can learn different relationships among the words.

  76. 76

    Why are Transformer layers often repeated?

    Model answer

    Repeating the self-attention and feed-forward layers allows the model to learn deeper patterns and richer representations of the input.

    Explanation

    Stacked layers progressively refine the encoded language information.

  77. 77

    How does a Transformer decoder use self-attention?

    Model answer

    The decoder uses self-attention to consider previously generated output words when predicting the next output word.

    Explanation

    The previous output context helps maintain coherence and grammatical sequence order.

  78. 78

    How does a Transformer decoder attend to the encoder?

    Model answer

    It uses an additional attention step to select which encoded input representations are most relevant for generating the next output word.

    Explanation

    This connects the output sequence to the information contained in the input sequence.

  79. 79

    Why are Transformers effective for large language models?

    Model answer

    Their attention-based design supports parallel training on large datasets while modeling relationships among words across a sequence.

    Explanation

    This improves both scalability and performance for tasks such as translation and conversational AI.

  80. 80

    What are some possible variations of the Transformer architecture?

    Model answer

    Some Transformers use only an encoder, some use only a decoder, and others combine encoder and decoder components differently.

    Explanation

    Despite these variations, attention remains the central idea.

  81. 81

    How do search, knowledge representation, probability, optimization, machine learning, and NLP illustrate different AI approaches?

    Model answer

    They address different forms of intelligent behavior: searching for solutions, representing knowledge, reasoning under uncertainty, optimizing objectives, learning from data, and understanding or generating language.

    Explanation

    Together, these approaches show that artificial intelligence includes multiple complementary methods for solving problems.

  82. 82

    What is the role of optimization in artificial intelligence?

    Model answer

    Optimization frames many AI problems as maximizing or minimizing an objective function.

    Explanation

    An AI system can search for decisions or parameters that produce the best value according to the chosen objective.

  83. 83

    What is the role of neural networks in machine learning?

    Model answer

    Neural networks learn weights from training data so they can identify patterns and map inputs to accurate outputs.

    Explanation

    They are especially useful when relationships between inputs and outputs are complex.

  84. 84

    Why is natural language especially challenging for artificial intelligence?

    Model answer

    Natural language has complex structure, ambiguity, context dependence, and a difference between grammatical form and meaningful interpretation.

    Explanation

    Effective language systems must address both syntax and semantics while handling variable-length sequences.

  85. 85

    How do modern NLP models address the problem of understanding context?

    Model answer

    They use learned statistical patterns, word vectors, recurrent states, attention, and Transformer architectures to represent relationships among words.

    Explanation

    These techniques progressively improve a model’s ability to interpret and generate meaningful language.

1 of 85
Question 1 of 85

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent