French language support for TextBlob.
Switch branches/tags
Nothing to show
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
tests
textblob_fr Bump version 0.1.0 -> 0.2.0 Oct 28, 2013
.gitignore Remove circular import in setup.py Sep 25, 2013
.travis.yml Ready for 0.1.0 release Sep 25, 2013
AUTHORS.rst Initial commit Sep 18, 2013
CONTRIBUTING.rst
HISTORY.rst Update imports for TB 0.8.0 Oct 28, 2013
LICENSE Initial commit Sep 18, 2013
MANIFEST.in Version 0.0.1 (experimental) Sep 23, 2013
NOTICE Initial commit Sep 18, 2013
README.rst Update imports for TB 0.8.0 Oct 28, 2013
dev-requirements.txt Ready for 0.1.0 release Sep 25, 2013
run_tests.py Initial commit Sep 18, 2013
setup.cfg Initial commit Sep 18, 2013
setup.py Update imports for TB 0.8.0 Oct 28, 2013
tox.ini Ready for 0.1.0 release Sep 25, 2013

README.rst

textblob-fr

Latest version Travis-CI

French language support for TextBlob.

Features

  • Part-of-speech tagging (PatternTagger)
  • Sentiment analysis (PatternAnalyzer)
  • Supports Python 2 and 3

Installing/Upgrading

If you have pip installed (you should), run

$ pip install -U textblob
$ pip install -U textblob-fr

Usage

>>> from textblob import TextBlob
>>> from textblob_fr import PatternTagger, PatternAnalyzer
>>> text = u"Quelle belle matinée"
>>> blob = TextBlob(text, pos_tagger=PatternTagger(), analyzer=PatternAnalyzer())
>>> blob.tags
[(u'Quelle', u'DT'), (u'belle', u'JJ'), (u'matin\xe9e', u'NN')]
>>> blob.sentiment
(0.8, 0.8)

Alternatively, you can use the Blobber class to avoid having to repeatedly pass the models into the TextBlob constructor.

>>> from textblob import Blobber
>>> from textblob_fr import PatternTagger, PatternAnalyzer
>>> tb = Blobber(pos_tagger=PatternTagger(), analyzer=PatternAnalyzer())
>>> blob1 = tb(u"Quelle belle matinée")
>>> blob1.sentiment
(0.8, 0.8)
>>> blob2 = tb(u"C'est une voiture terribles.")
>>> blob2.sentiment
(-0.7, 0.6)
>>> blob1.analyzer is blob2.analyzer
True

Requirements

  • Python >= 2.6 or >= 3.3

TODO

  • Tokenization
  • Parsing
  • NLTK tagging?

License

MIT licensed. See the bundled LICENSE file for more details.