Natural Language Processing with spaCy
- 24Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
What is natural language processing (NLP)?
What is natural language processing (NLP)?
24 questions
- 1
What is natural language processing (NLP)?
- A
The process of getting a computer system to understand, parse, and extract human language
- B
The process of training neural networks on image data
- C
The translation of human language into machine code
- D
The creation of rule-based databases for storing language corpora
Correct answer
AThe 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.
- A
- 2
Which of the following is NOT an area of natural language processing (NLP)?
- A
Part-of-speech tagging
- B
Text categorization
- C
Named entity recognition
- D
Image classification
Correct answer
DImage 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.
- A
- 3
What is natural language understanding (NLU)?
- A
A subfield of computational linguistics that focuses on relation extraction, semantic parsing, and question answering
- B
The process of converting speech to text
- C
The same as natural language processing
- D
A library for building chatbots
Correct answer
AA 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.
- A
- 4
What is the goal of information extraction in NLP?
- A
To correct spelling errors in documents
- B
To classify text into predefined categories
- C
To convert unstructured data (raw text) into structured data or metadata
- D
To generate human-like responses in a conversation
Correct answer
CTo 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.
- A
- 5
Which real-world application of NLP is described as being nearly perfect and used for spam detection?
- A
Text categorization (classification)
- B
Information extraction
- C
Coreference resolution
- D
Machine translation
Correct answer
AText 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.
- A
- 6
According to the content, how do lawyers use NLP to handle large volumes of documents?
- A
By using NLP for classification and information extraction to reduce millions of documents to a manageable number
- B
By converting documents into audio files for faster review
- C
By training chatbots to review each document
- D
By manually reading every document with the help of automated page-turning
Correct answer
ABy 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.
- A
- 7
Which of the following is a key advantage of using the spaCy framework for NLP?
- A
It is the only NLP framework available for Python
- B
It can only be used with GPU for processing
- C
It provides pre-trained models that benchmark well and have good accuracy metrics
- D
It requires no installation; it runs directly in the browser
Correct answer
CIt 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.
- A
- 8
What is one of the main reasons spaCy is considered to scale well?
- A
It automatically distributes processing across multiple computers
- B
It uses a proprietary language that compiles quickly
- C
It only works with small datasets
- D
It can process hundreds of thousands of documents efficiently
Correct answer
DIt 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.
- A
- 9
Which command is used to install the spaCy library?
- A
pip install spacy
- B
conda install nlp
- C
python -m nltk download
- D
spacy install python
Correct answer
Apip install spacy
Explanation
The correct command to install spaCy is
pip install spacy. Then a model can be downloaded withpython -m spacy download en_core_web_sm. - A
- 10
What is the recommended model to download for English text in the introductory spaCy tutorial?
- A
en_core_web_lg
- B
en_core_web_trf
- C
en_core_web_sm
- D
en_core_web_md
Correct answer
Cen_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.
- A
- 11
When installing spaCy, what is the recommended configuration for beginners?
- A
Select CPU and download the small English model
- B
Select GPU and download the transformer model
- C
Select CPU and download the full pipeline
- D
Select GPU and download the large English model
Correct answer
ASelect 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.
- A
- 12
In a Jupyter Notebook, how do you execute a terminal command to install spaCy?
- A
Type the command in a code block without any prefix
- B
Use the % (percent) character before the command
- C
Use the ! (exclamation mark) at the beginning of the command
- D
Open a separate terminal window and run the command manually
Correct answer
CUse 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. - A
- 13
What is the primary container object in spaCy that holds all metadata about a text?
- A
Token
- B
Span
- C
Doc
- D
Lexeme
Correct answer
CDoc
Explanation
The Doc object is the central container in spaCy; it contains all metadata about the text passed to the NLP pipeline.
- A
- 14
In spaCy, what is a token?
- A
A custom pipeline component
- B
A sentence within a document
- C
A sequence of multiple words that form a named entity
- D
An individual element such as a word or punctuation mark
Correct answer
DAn 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.
- A
- 15
How does a span differ from a token in spaCy?
- A
A span can be either a single token or a sequence of tokens
- B
A span is larger than a document
- C
A span is always a single word
- D
A span is only used for punctuation
Correct answer
AA 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.
- A
- 16
Which of the following is NOT a container type mentioned in the spaCy introduction?
- A
Corpus
- B
Lexeme
- C
Doc
- D
Token
Correct answer
ACorpus
Explanation
The containers mentioned are Doc, Token, Span, Lexeme, Language, SpanGroup, and DocBin. 'Corpus' is not a container type in spaCy.
- A
- 17
What is the purpose of the NLP object created with spacy.load()?
- A
To download a word embedding file
- B
To install spaCy dependencies
- C
To visualize the dependency parse tree
- D
To load a trained model and create a pipeline for processing text
Correct answer
DTo 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.
- A
- 18
What metrics are used to measure the accuracy of spaCy's off-the-shelf models?
- A
BLEU score and perplexity
- B
R-squared and adjusted R-squared
- C
Mean squared error and accuracy
- D
Precision, recall, and F-score
Correct answer
DPrecision, recall, and F-score
Explanation
The content states that spaCy's models have good accuracy metrics such as precision, recall, and F-score.
- A
- 19
What type of machine learning models does spaCy support for current NLP methods?
- A
Transformer models (e.g., BERT)
- B
Generative adversarial networks (GANs)
- C
Convolutional neural networks (CNNs)
- D
Recurrent neural networks (RNNs)
Correct answer
ATransformer models (e.g., BERT)
Explanation
spaCy has the ability to leverage current NLP methods, specifically transformer models often referred to collectively as BERT models.
- A
- 20
What is the primary advantage of using off-the-shelf models in spaCy?
- A
They provide general solutions to general problems without custom training
- B
They require no installation
- C
They can only be used with GPU
- D
They are always faster than custom models
Correct answer
AThey 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.
- A
- 21
Which example is given of using spaCy for information extraction in a specific domain?
- A
Translating English to Spanish
- B
Classifying emails as spam or not spam
- C
Extracting company names, stocks, and indexes from financial news
- D
Generating summaries of Wikipedia articles
Correct answer
CExtracting 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.
- A
- 22
What is the entity ruler in spaCy used for?
- A
Measuring the accuracy of named entity recognition
- B
Adding rules to identify entities in text
- C
Visualizing named entities in a document
- D
Downloading pre-built entity lists
Correct answer
BAdding rules to identify entities in text
Explanation
The entity ruler is a rules-based component in spaCy used to identify entities via custom patterns.
- A
- 23
In the context of NLP, what does it mean for a task to be 'solved' according to the content?
- A
Information extraction is impossible
- B
Spam detection is considered nearly perfect
- C
Machine translation is completely solved
- D
All NLP tasks are solved by transformer models
Correct answer
BSpam 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.
- A
- 24
According to the content, how should a learner use the video and textbook effectively?
- A
Skip the video and use only the textbook exercises
- B
Watch the entire video without coding, then read the textbook
- C
Only read the textbook and ignore the video
- D
Watch the video once, then replicate the code, then try to do it independently
Correct answer
DWatch 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.
- A

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