Python for Programmers (Alan Kwok's Library) by Paul Deitel & Harvey Deitel

Python for Programmers (Alan Kwok's Library) by Paul Deitel & Harvey Deitel

Author:Paul Deitel & Harvey Deitel
Language: eng
Format: epub
Publisher: Pearson
Published: 2019-07-15T00:00:00+00:00


11.2.1 Create a TextBlob

TextBlob6 is the fundamental class for NLP with the textblob module. Let’s create a TextBlob containing two sentences:

6http://textblob.readthedocs.io/en/latest/api_reference.html#textblob.blob.TextBlob.

Click here to view code image

In [1]: from textblob import TextBlob In [2]: text = 'Today is a beautiful day. Tomorrow looks like bad weather.' In [3]: blob = TextBlob(text) In [4]: blob Out[4]: TextBlob("Today is a beautiful day. Tomorrow looks like bad weather.")

TextBlobs—and, as you’ll see shortly, Sentences and Words—support string methods and can be compared with strings. They also provide methods for various NLP tasks. Sentences, Words and TextBlobs inherit from BaseBlob, so they have many common methods and properties.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.