In [1]:
# Import a text processing library
from textblob import TextBlob
In [2]:
# Some test sentences
sentences = ["It is a pleasant day and the weather is such a bliss.", 
             "It is a damn awful weather and I hate to be outside today."]
In [17]:
# Analysis method
def analysis():
    for sentence in sentences:
        # Instantiate TextBlob
        analysis = TextBlob(sentence)
        # Parts of speech
        print("{}\n\nParts of speech:\n{}\n".format(sentence, analysis.tags))
        # Sentiment analysis
        print("Sentiment:\n{}\n\n".format(analysis.sentiment))
In [16]:
analysis()
It is a pleasant day and the weather is such a bliss.

Parts of speech:
[('It', 'PRP'), ('is', 'VBZ'), ('a', 'DT'), ('pleasant', 'JJ'), ('day', 'NN'), ('and', 'CC'), ('the', 'DT'), ('weather', 'NN'), ('is', 'VBZ'), ('such', 'JJ'), ('a', 'DT'), ('bliss', 'NN')]

Sentiment:
Sentiment(polarity=0.36666666666666664, subjectivity=0.7333333333333334)


It is a damn awful weather and I hate to be outside today.

Parts of speech:
[('It', 'PRP'), ('is', 'VBZ'), ('a', 'DT'), ('damn', 'NN'), ('awful', 'JJ'), ('weather', 'NN'), ('and', 'CC'), ('I', 'PRP'), ('hate', 'VBP'), ('to', 'TO'), ('be', 'VB'), ('outside', 'JJ'), ('today', 'NN')]

Sentiment:
Sentiment(polarity=-0.6, subjectivity=0.65)


About the results

The sentiment of the sentences are expressed in terms of polarity and subjectivity. Polarity is scored from -1.0 to +1.0 and subjectivity is scored from 0.0 to 1.0.

In the above results, the polarity of the first sentence is +0.36, reflecting the positive sentiment. For the second sentence, the polarity is negative -0.6, classifying it as a negative sentiment.