Bắt đầu ngayBắt đầu miễn phí

What is the sentiment of a movie review?

In a previous exercise, you detected the sentiment of the first sentence of the Tale of Two Cities novel by Dickens. Now you will continue to work with the movie reviews dataset. Do you remember how you found the longest and shortest reviews? One of the longest reviews has been imported for you. It is called titanic as it discusses the Titanic movie. Feel free to explore it in the Shell.

Can you calculate the polarity and subjectivity of the titanic string? This review is positive (i.e. has a label of 1). Is the polarity score also positive?

Bài tập này là một phần của khóa học

Sentiment Analysis in Python

Xem khóa học

Hướng dẫn bài tập

  • Import the required functionality.
  • Create a text blob object from the titanic string.
  • Print out the result of its sentiment property.

Bài tập tương tác thực hành trực tiếp

Hãy thử làm bài tập này bằng cách hoàn thành đoạn mã mẫu này.

# Import the required packages
____

# Create a textblob object  
blob_titanic = ____(titanic)

# Print out its sentiment  
print(_____.____)
Chỉnh sửa và Chạy Mã