github 位址:https://github.com/sloria/textblob/
文檔位址:https://textblob.readthedocs.io/en/dev/
我學習textblob的原因如下:
我想學習下如何用 python 進行文本處理。
first, the import.
returns a namedtuple of the form <code>sentiment(polarity, subjectivity)</code>. the polarity score is a float within the range [-1.0, 1.0]. the subjectivity is a float within the range
[0.0, 1.0] where 0.0 is very objective and 1.0 is very subjective.
you can break textblobs into words or sentences.
have the same properties and methods as textblobs.
(a subclass of <code>unicode</code>) with useful methods, e.g. for word inflection.
optionally passing in a part of speech.
which can also take an optional part-of-speech argument.
you can also create synsets directly.
a <code>wordlist</code> is just a python list with additional methods.
to attempt spelling correction.
have a <code>spellcheck() word.spellcheck()</code> method that returns a list of <code>(word,confidence)</code> tuples
with spelling suggestions.
the first is through the <code>word_counts</code> dictionary.
if you access the frequencies this way, the search will not be case sensitive, and words that are not found will have a frequency of 0.
the second way is to use the <code>count()</code> method.
you can specify whether or not the search should be case-sensitive (default is <code>false</code>).
each of these methods can also be used with noun phrases.
new in version <code>0.5.0</code>.
textblobs can be translated between languages.
the translated result is the same as the input string.
to parse the text.
you can use python’s substring syntax.
you can use common string methods.
you can make comparisons between textblobs and strings.
you can concatenate and interpolate textblobs and strings.
returns a list of tuples of <code>n</code> successive words.
textblob is a python (2 and 3) library for processing textual data. it provides a simple api for diving into common natural language processing (nlp) tasks such as part-of-speech tagging, noun phrase extraction, sentiment analysis, classification, translation,
and more.
and plays nicely with both.
<a target="_blank"></a>
noun phrase extraction
part-of-speech tagging
sentiment analysis
classification (naive bayes, decision tree)
language translation and detection powered by google translate
tokenization (splitting text into words and sentences)
word and phrase frequencies
parsing
n-grams
word inflection (pluralization and singularization) and lemmatization
spelling correction
add new models or languages through extensions
wordnet integration
python >= 2.7 or >= 3.3