0
0
NLPml~10 mins

Why summarization condenses information in NLP - Test Your Understanding

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

Complete the code to create a summary by selecting the first sentence.

NLP
text = "Machine learning helps computers learn from data. It improves tasks automatically."
summary = text.split('. ')[[1]]
Drag options to blanks, or click blank then click option'
A1
B0
C-1
D2
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing index 1 instead of 0
Using -1 which selects the last sentence
2fill in blank
medium

Complete the code to count the number of words in the summary.

NLP
summary = "Machine learning helps computers learn from data"
word_count = len(summary.[1]())
Drag options to blanks, or click blank then click option'
Areplace
Bjoin
Csplit
Dstrip
Attempts:
3 left
💡 Hint
Common Mistakes
Using join which combines words
Using replace which changes characters
3fill in blank
hard

Fix the error in the code to generate a summary by joining the first two sentences.

NLP
text = "AI is a field of computer science. It focuses on creating smart machines."
summary = '. '.join(text.split('. ')[:[1]])
Drag options to blanks, or click blank then click option'
A0
B1
C3
D2
Attempts:
3 left
💡 Hint
Common Mistakes
Using 1 which only selects the first sentence
Using 3 which selects extra sentences
4fill in blank
hard

Fill both blanks to create a dictionary of sentence lengths for sentences longer than 5 words.

NLP
text = "Summarization reduces text length. It keeps important info."
sentences = text.split('. ')
lengths = {sentence: len(sentence.[1]()) for sentence in sentences if len(sentence.[2]()) > 5}
Drag options to blanks, or click blank then click option'
Asplit
Bjoin
Creplace
Dstrip
Attempts:
3 left
💡 Hint
Common Mistakes
Using join which combines words
Using strip which removes spaces
5fill in blank
hard

Fill all three blanks to create a summary dictionary with sentence keys in uppercase and word counts greater than 3.

NLP
text = "Summarization condenses information. It helps understand quickly."
sentences = text.split('. ')
summary = {sentence.[1](): len(sentence.[2]()) for sentence in sentences if len(sentence.[3]()) > 3}
Drag options to blanks, or click blank then click option'
Aupper
Bsplit
Cstrip
Dlower
Attempts:
3 left
💡 Hint
Common Mistakes
Using lower() instead of upper()
Using strip() which removes spaces but doesn't split words