Complete the code to import the VADER sentiment analyzer from NLTK.
from nltk.sentiment.vader import [1]
The correct class to import for VADER sentiment analysis is SentimentIntensityAnalyzer.
Complete the code to create an instance of the VADER sentiment analyzer.
analyzer = [1]()You create an instance by calling SentimentIntensityAnalyzer().
Fix the error in the code to get the sentiment scores for the text.
scores = analyzer.[1]('I love learning AI!')
The method to get sentiment scores is polarity_scores.
Complete the code to extract the compound score from the sentiment scores dictionary.
compound_score = scores['[1]']
To get the compound score, use scores['compound'].
Complete the code to create a dictionary comprehension that maps sentences to their compound sentiment scores.
sentence_scores = {sentence: analyzer.[1](sentence)['compound'] for sentence in sentences}The dictionary comprehension uses sentence: analyzer.polarity_scores(sentence)['compound'] for each sentence.