0
0
NLPml~10 mins

Why NLP bridges humans and computers - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the main NLP library used for processing human language.

NLP
import [1]
Drag options to blanks, or click blank then click option'
Anltk
Btensorflow
Cmatplotlib
Dsklearn
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing general machine learning libraries like tensorflow or sklearn instead of an NLP-specific one.
2fill in blank
medium

Complete the code to tokenize a sentence into words using NLTK.

NLP
from nltk.tokenize import word_tokenize
sentence = 'Hello world!'
tokens = [1](sentence)
Drag options to blanks, or click blank then click option'
Aparse
Bsplit
Ctokenize_words
Dword_tokenize
Attempts:
3 left
💡 Hint
Common Mistakes
Using string split which does not handle punctuation properly.
Using a non-existent function like tokenize_words.
3fill in blank
hard

Fix the error in the code to convert all tokens to lowercase.

NLP
tokens = ['Hello', 'World']
lower_tokens = [token.[1]() for token in tokens]
Drag options to blanks, or click blank then click option'
Aupper
Btitle
Clower
Dcapitalize
Attempts:
3 left
💡 Hint
Common Mistakes
Using upper() which makes letters uppercase instead.
Using capitalize() which only changes the first letter.
4fill in blank
hard

Fill both blanks to create a dictionary of word lengths for words longer than 3 letters.

NLP
words = ['chat', 'ai', 'language', 'nlp']
lengths = {word: [1] for word in words if len(word) [2] 3}
Drag options to blanks, or click blank then click option'
Alen(word)
B<=
C>
Dword
Attempts:
3 left
💡 Hint
Common Mistakes
Using the word itself as the value instead of its length.
Using <= instead of > which includes shorter words.
5fill in blank
hard

Fill all three blanks to create a dictionary of uppercase words and their lengths for words longer than 2 letters.

NLP
words = ['data', 'ai', 'ml', 'python']
result = { [1]: [2] for word in words if len(word) [3] 2 }
Drag options to blanks, or click blank then click option'
Aword.upper()
Blen(word)
C>
Dword
Attempts:
3 left
💡 Hint
Common Mistakes
Using the original word as key instead of uppercase.
Using <= instead of > which includes shorter words.