Challenge: Stemming
Uppgift
Swipe to start coding
You are given some text in text
variable. Your task is to tokenize this text, remove the stop words, and apply stemming on tokens. To do this:
- Import Porter Stemmer.
- Convert
text
to lowercase and save it intext_lower
. - Tokenize the
text_lower
string and save the result intokens
. - Load English stop words, convert them to
set
, and save instop_words
. - Filter out the stop words using list comprehension and save the result in
filtered_tokens
. - Create a Porter Stemmer and save it in
stemmer
. - Stem the tokens using list comprehension and save the result in
stemmed_tokens
.
Lösning
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 2. Kapitel 2
single
Fråga AI
Fråga AI
Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal
Suggested prompts:
Sammanfatta detta kapitel
Explain code
Explain why doesn't solve task
Awesome!
Completion rate improved to 3.45
Challenge: Stemming
Svep för att visa menyn
Uppgift
Swipe to start coding
You are given some text in text
variable. Your task is to tokenize this text, remove the stop words, and apply stemming on tokens. To do this:
- Import Porter Stemmer.
- Convert
text
to lowercase and save it intext_lower
. - Tokenize the
text_lower
string and save the result intokens
. - Load English stop words, convert them to
set
, and save instop_words
. - Filter out the stop words using list comprehension and save the result in
filtered_tokens
. - Create a Porter Stemmer and save it in
stemmer
. - Stem the tokens using list comprehension and save the result in
stemmed_tokens
.
Lösning
Var allt tydligt?
Tack för dina kommentarer!
Awesome!
Completion rate improved to 3.45Avsnitt 2. Kapitel 2
single