<s> """<STR_LIT>""" <EOL> from __future__ import absolute_import <EOL> import nltk <EOL> from textblob . en import tag as pattern_tag <EOL> from textblob . decorators import requires_nltk_corpus <EOL> from textblob . tokenizers import word_tokenize <EOL> from textblob . base import BaseTagger <EOL> class PatternTagger ( BaseTagger ) : <EOL> """<STR_LIT>""" <EOL> def tag ( self , text , tokenize = True ) : <EOL> """<STR_LIT>""" <EOL> return pattern_tag ( text , tokenize ) <EOL> class NLTKTagger ( BaseTagger ) : <EOL> """<STR_LIT>""" <EOL> @ requires_nltk_corpus <EOL> def tag ( self , text , tokenize = True ) : <EOL> """<STR_LIT>""" <EOL> if tokenize : <EOL> text = list ( word_tokenize ( text ) ) <EOL> tagged = nltk . tag . pos_tag ( text ) <EOL> return tagged </s>
