LoslegenKostenlos loslegen

Using your package's new functionality

You've now created some great functionality for text analysis to your package. In this exercise, you'll leverage your package to analyze some tweets written by DataCamp & DataCamp users.

The object word_counts is loaded into your environment. It contains a list of Counter objects that contain word counts from a sample of DataCamp tweets.

The structure you've created can be seen in the tree below. You'll be working in my_script.py.

working_dir
├── text_analyzer
│    ├── __init__.py
│    ├── counter_utils.py
└── my_script.py

Diese Übung ist Teil des Kurses

Software Engineering Principles in Python

Kurs anzeigen

Anleitung zur Übung

  • import your text_analyzer at the top of the script.
  • Use the sum_counters() function from text_analyzer to aggregate all the Counters in word_counts.
  • Use the plot_counter() function from text_analyzer to visualize the tweet's most used words while tweeting.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Import local package
import ____

# Sum word_counts using sum_counters from text_analyzer
word_count_totals = ____.____(word_counts)

# Plot word_count_totals using plot_counter from text_analyzer
____.____(word_count_totals)
Code bearbeiten und ausführen