Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Challenge: Bag of Words | Basic Text Models
Introduction to NLP

Свайпніть щоб показати меню

book
Challenge: Bag of Words

Завдання

Swipe to start coding

You have a text corpus stored in corpus variable. Your task is to display the vector for the 'graphic design' bigram in a BoW model. To do this:

  1. Import the CountVectorizer class to create a BoW model.
  2. Instantiate the CountVectorizer class as count_vectorizer, configuring it for a frequency-based model that includes both unigrams and bigrams.
  3. Use the appropriate method of count_vectorizer to generate a BoW matrix from the 'Document' column in the corpus and store the result in bow_matrix.
  4. Convert bow_matrix to a dense array and create a DataFrame from it, setting the unique features (unigrams and bigrams) as its columns. Store the result in the bow_df variable.
  5. Display the vector for 'graphic design' bigram as an array.

Рішення

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 3. Розділ 5
single

single

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

close

Awesome!

Completion rate improved to 3.45

book
Challenge: Bag of Words

Завдання

Swipe to start coding

You have a text corpus stored in corpus variable. Your task is to display the vector for the 'graphic design' bigram in a BoW model. To do this:

  1. Import the CountVectorizer class to create a BoW model.
  2. Instantiate the CountVectorizer class as count_vectorizer, configuring it for a frequency-based model that includes both unigrams and bigrams.
  3. Use the appropriate method of count_vectorizer to generate a BoW matrix from the 'Document' column in the corpus and store the result in bow_matrix.
  4. Convert bow_matrix to a dense array and create a DataFrame from it, setting the unique features (unigrams and bigrams) as its columns. Store the result in the bow_df variable.
  5. Display the vector for 'graphic design' bigram as an array.

Рішення

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

close

Awesome!

Completion rate improved to 3.45

Свайпніть щоб показати меню

some-alt