NLP Flashcards

(25 cards)

1
Q

What is NLP?

A

NLP (Natural Language Processing) is a field of AI that helps computers understand, interpret, and generate human language.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do you install the spaCy library?

A

!pip install spacy

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you download the English language model for spaCy?

A

!python -m spacy download en_core_web_sm

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How do you load the English spaCy model?

A

nlp = spacy.load(‘en_core_web_sm’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do you create a spaCy document object from text?

A

doc = nlp(text)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do you perform sentence boundary detection in spaCy?

A

Use doc.sents and loop through it: for sent in doc.sents: print(sent.text)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is tokenization?

A

Breaking text into individual units such as words or punctuation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do you tokenize a document in spaCy?

A

for token in doc: print(token.text)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is lemmatization?

A

Reducing a word to its base or dictionary form.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How do you perform lemmatization in spaCy?

A

token.lemma_

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is Part of Speech (POS) tagging?

A

Labeling each word with its grammatical role like noun, verb, etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How do you perform POS tagging in spaCy?

A

token.pos_

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is Named Entity Recognition (NER)?

A

Identifying names, places, organizations, dates, and other proper entities in text.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How do you perform Named Entity Recognition in spaCy?

A

for ent in doc.ents: print(ent.text, ent.label_)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How do you calculate semantic similarity between two documents in spaCy?

A

doc1.similarity(doc2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What does token.like_url do?

A

Returns True if the token looks like a URL.

17
Q

What does token.like_email do?

A

Returns True if the token looks like an email address.

18
Q

How do you get the syntactic dependency of a token?

19
Q

How do you access the language of the token?

20
Q

How do you access the named entities in a spaCy document?

21
Q

How do you convert a sentence into a list of tokens?

A

[token.text for token in doc]

22
Q

How do you access a specific sentence from a doc?

A

sentences = list(doc.sents); sentences[index]

23
Q

How do you get the lemma of all tokens in a doc?

A

[token.lemma_ for token in doc]

24
Q

How do you identify if a token is a punctuation mark?

A

token.is_punct

25
How do you filter out stop words from a spaCy document?
[token for token in doc if not token.is_stop]