'A simple shallow parser using a Brill-based part-of-speech tagger.
The given lexicon is a dictionary of known words and their part-of-speech tag.
The given default tags are used for unknown words.
Unknown words that start with a capital letter are tagged NNP (except for German).
Unknown words that contain only digits and punctuation are tagged CD.
Optionally, morphological and contextual rules (or a language model) can be used
to improve the tags of unknown words.
The given language can be used to discern between
Germanic and Romance languages for phrase chunking.'

def __init__(self, lexicon={}, frequency={}, model=None, morphology=None, context=None, entities=None, default=('NN', 'NNP', 'CD'), language=None):

    self.lexicon = (lexicon or {})
    self.frequency = (frequency or {})
    self.model = model
    self.morphology = morphology
    self.context = context
    self.entities = entities
    self.default = default
    self.language = language
    f = (lambda s: (isinstance(s, basestring) or hasattr(s, 'read')))
    if f(lexicon):
        self.lexicon = Lexicon(path=lexicon)
    if f(frequency):
        self.frequency = Frequency(path=frequency)
    if f(morphology):
        self.morphology = Morphology(path=morphology, known=self.lexicon)
    if f(context):
        self.context = Context(path=context)
    if f(entities):
        self.entities = Entities(path=entities, tag=default[1])
    if f(model):
        try:
            self.model = Model(path=model)
        except ImportError:
            pass
