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

Study methods

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

Natural Language Processing with spaCy

  • 24Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: NLP Fundamentals

What is natural language processing (NLP)?

24 questions

  1. 1

    What is natural language processing (NLP)?

    1. A

      The process of getting a computer system to understand, parse, and extract human language

    2. B

      The process of training neural networks on image data

    3. C

      The translation of human language into machine code

    4. D

      The creation of rule-based databases for storing language corpora

    Correct answer
    A

    The process of getting a computer system to understand, parse, and extract human language

    Explanation

    NLP is defined as the process by which we try to get a computer system to understand and parse and extract human language, often with raw text.

  2. 2

    Which of the following is NOT an area of natural language processing (NLP)?

    1. A

      Part-of-speech tagging

    2. B

      Text categorization

    3. C

      Named entity recognition

    4. D

      Image classification

    Correct answer
    D

    Image classification

    Explanation

    NLP areas include named entity recognition, part-of-speech tagging, syntactic parsing, text categorization, coreference resolution, and machine translation. Image classification is not part of NLP; it belongs to computer vision.

  3. 3

    What is natural language understanding (NLU)?

    1. A

      A subfield of computational linguistics that focuses on relation extraction, semantic parsing, and question answering

    2. B

      The process of converting speech to text

    3. C

      The same as natural language processing

    4. D

      A library for building chatbots

    Correct answer
    A

    A subfield of computational linguistics that focuses on relation extraction, semantic parsing, and question answering

    Explanation

    NLU is described as a computational linguistics field where we train computer systems to do relation extraction, semantic parsing, question answering, summarization, sentiment analysis, and paraphrasing.

  4. 4

    What is the goal of information extraction in NLP?

    1. A

      To correct spelling errors in documents

    2. B

      To classify text into predefined categories

    3. C

      To convert unstructured data (raw text) into structured data or metadata

    4. D

      To generate human-like responses in a conversation

    Correct answer
    C

    To convert unstructured data (raw text) into structured data or metadata

    Explanation

    Information extraction takes unstructured data (raw text) and extracts structured data or metadata, finding relevant information such as names, stocks, or indexes.

  5. 5

    Which real-world application of NLP is described as being nearly perfect and used for spam detection?

    1. A

      Text categorization (classification)

    2. B

      Information extraction

    3. C

      Coreference resolution

    4. D

      Machine translation

    Correct answer
    A

    Text categorization (classification)

    Explanation

    Text categorization (classification) is used for spam detection; it is described as nearly perfect, with a machine learning model assigning spam labels to emails.

  6. 6

    According to the content, how do lawyers use NLP to handle large volumes of documents?

    1. A

      By using NLP for classification and information extraction to reduce millions of documents to a manageable number

    2. B

      By converting documents into audio files for faster review

    3. C

      By training chatbots to review each document

    4. D

      By manually reading every document with the help of automated page-turning

    Correct answer
    A

    By using NLP for classification and information extraction to reduce millions of documents to a manageable number

    Explanation

    Lawyers use NLP to do classification and information extraction, finding relevant keywords and classifying documents to reduce a large set to a handful that need human attention.

  7. 7

    Which of the following is a key advantage of using the spaCy framework for NLP?

    1. A

      It is the only NLP framework available for Python

    2. B

      It can only be used with GPU for processing

    3. C

      It provides pre-trained models that benchmark well and have good accuracy metrics

    4. D

      It requires no installation; it runs directly in the browser

    Correct answer
    C

    It provides pre-trained models that benchmark well and have good accuracy metrics

    Explanation

    spaCy provides off-the-shelf models that benchmark well, have good accuracy (precision, recall, F-score), leverage transformer models, support custom training, and scale well.

  8. 8

    What is one of the main reasons spaCy is considered to scale well?

    1. A

      It automatically distributes processing across multiple computers

    2. B

      It uses a proprietary language that compiles quickly

    3. C

      It only works with small datasets

    4. D

      It can process hundreds of thousands of documents efficiently

    Correct answer
    D

    It can process hundreds of thousands of documents efficiently

    Explanation

    spaCy scales well because it can process hundreds of thousands of documents with relative ease and speed, especially with rules-based components.

  9. 9

    Which command is used to install the spaCy library?

    1. A

      pip install spacy

    2. B

      conda install nlp

    3. C

      python -m nltk download

    4. D

      spacy install python

    Correct answer
    A

    pip install spacy

    Explanation

    The correct command to install spaCy is pip install spacy. Then a model can be downloaded with python -m spacy download en_core_web_sm.

  10. 10

    What is the recommended model to download for English text in the introductory spaCy tutorial?

    1. A

      en_core_web_lg

    2. B

      en_core_web_trf

    3. C

      en_core_web_sm

    4. D

      en_core_web_md

    Correct answer
    C

    en_core_web_sm

    Explanation

    The tutorial recommends downloading the small English model, en_core_web_sm, for initial practice. It is the default small model.

  11. 11

    When installing spaCy, what is the recommended configuration for beginners?

    1. A

      Select CPU and download the small English model

    2. B

      Select GPU and download the transformer model

    3. C

      Select CPU and download the full pipeline

    4. D

      Select GPU and download the large English model

    Correct answer
    A

    Select CPU and download the small English model

    Explanation

    The instructor advises beginners to select CPU and the small English model (en_core_web_sm) because GPU requires more understanding and configuration.

  12. 12

    In a Jupyter Notebook, how do you execute a terminal command to install spaCy?

    1. A

      Type the command in a code block without any prefix

    2. B

      Use the % (percent) character before the command

    3. C

      Use the ! (exclamation mark) at the beginning of the command

    4. D

      Open a separate terminal window and run the command manually

    Correct answer
    C

    Use the ! (exclamation mark) at the beginning of the command

    Explanation

    In Jupyter Notebook, placing an exclamation mark before a command tells the notebook to execute it as a terminal command, e.g., !pip install spacy.

  13. 13

    What is the primary container object in spaCy that holds all metadata about a text?

    1. A

      Token

    2. B

      Span

    3. C

      Doc

    4. D

      Lexeme

    Correct answer
    C

    Doc

    Explanation

    The Doc object is the central container in spaCy; it contains all metadata about the text passed to the NLP pipeline.

  14. 14

    In spaCy, what is a token?

    1. A

      A custom pipeline component

    2. B

      A sentence within a document

    3. C

      A sequence of multiple words that form a named entity

    4. D

      An individual element such as a word or punctuation mark

    Correct answer
    D

    An individual element such as a word or punctuation mark

    Explanation

    Tokens are individual items like words or punctuation marks that have self-contained syntactic or semantic value.

  15. 15

    How does a span differ from a token in spaCy?

    1. A

      A span can be either a single token or a sequence of tokens

    2. B

      A span is larger than a document

    3. C

      A span is always a single word

    4. D

      A span is only used for punctuation

    Correct answer
    A

    A span can be either a single token or a sequence of tokens

    Explanation

    A span can be a single token (e.g., a city name) or a sequence of multiple tokens (e.g., 'Martin Luther King'). It represents a self-contained item within the Doc.

  16. 16

    Which of the following is NOT a container type mentioned in the spaCy introduction?

    1. A

      Corpus

    2. B

      Lexeme

    3. C

      Doc

    4. D

      Token

    Correct answer
    A

    Corpus

    Explanation

    The containers mentioned are Doc, Token, Span, Lexeme, Language, SpanGroup, and DocBin. 'Corpus' is not a container type in spaCy.

  17. 17

    What is the purpose of the NLP object created with spacy.load()?

    1. A

      To download a word embedding file

    2. B

      To install spaCy dependencies

    3. C

      To visualize the dependency parse tree

    4. D

      To load a trained model and create a pipeline for processing text

    Correct answer
    D

    To load a trained model and create a pipeline for processing text

    Explanation

    The NLP object is created by loading a model (e.g., spacy.load('en_core_web_sm')). It is used to process text and produce Doc objects.

  18. 18

    What metrics are used to measure the accuracy of spaCy's off-the-shelf models?

    1. A

      BLEU score and perplexity

    2. B

      R-squared and adjusted R-squared

    3. C

      Mean squared error and accuracy

    4. D

      Precision, recall, and F-score

    Correct answer
    D

    Precision, recall, and F-score

    Explanation

    The content states that spaCy's models have good accuracy metrics such as precision, recall, and F-score.

  19. 19

    What type of machine learning models does spaCy support for current NLP methods?

    1. A

      Transformer models (e.g., BERT)

    2. B

      Generative adversarial networks (GANs)

    3. C

      Convolutional neural networks (CNNs)

    4. D

      Recurrent neural networks (RNNs)

    Correct answer
    A

    Transformer models (e.g., BERT)

    Explanation

    spaCy has the ability to leverage current NLP methods, specifically transformer models often referred to collectively as BERT models.

  20. 20

    What is the primary advantage of using off-the-shelf models in spaCy?

    1. A

      They provide general solutions to general problems without custom training

    2. B

      They require no installation

    3. C

      They can only be used with GPU

    4. D

      They are always faster than custom models

    Correct answer
    A

    They provide general solutions to general problems without custom training

    Explanation

    Off-the-shelf models allow users to implement general solutions to general problems easily, without needing to train custom models.

  21. 21

    Which example is given of using spaCy for information extraction in a specific domain?

    1. A

      Translating English to Spanish

    2. B

      Classifying emails as spam or not spam

    3. C

      Extracting company names, stocks, and indexes from financial news

    4. D

      Generating summaries of Wikipedia articles

    Correct answer
    C

    Extracting company names, stocks, and indexes from financial news

    Explanation

    In part three of the video, the instructor uses spaCy to extract information like company names, stocks, indexes from financial documents.

  22. 22

    What is the entity ruler in spaCy used for?

    1. A

      Measuring the accuracy of named entity recognition

    2. B

      Adding rules to identify entities in text

    3. C

      Visualizing named entities in a document

    4. D

      Downloading pre-built entity lists

    Correct answer
    B

    Adding rules to identify entities in text

    Explanation

    The entity ruler is a rules-based component in spaCy used to identify entities via custom patterns.

  23. 23

    In the context of NLP, what does it mean for a task to be 'solved' according to the content?

    1. A

      Information extraction is impossible

    2. B

      Spam detection is considered nearly perfect

    3. C

      Machine translation is completely solved

    4. D

      All NLP tasks are solved by transformer models

    Correct answer
    B

    Spam detection is considered nearly perfect

    Explanation

    The content states that spam detection is nearly perfect and needs continuous updates, but it is considered a solved problem.

  24. 24

    According to the content, how should a learner use the video and textbook effectively?

    1. A

      Skip the video and use only the textbook exercises

    2. B

      Watch the entire video without coding, then read the textbook

    3. C

      Only read the textbook and ignore the video

    4. D

      Watch the video once, then replicate the code, then try to do it independently

    Correct answer
    D

    Watch the video once, then replicate the code, then try to do it independently

    Explanation

    The instructor recommends a three-pass approach: watch once for overview, replicate the code, then try to do it on your own without looking at references.

Question 1 of 24
Question 1 of 24

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent