Ejemplo n.º 1
0
    def __init__(self,
                 use_lemmas=False,
                 entity_types_to_censor=set(),
                 tag_types_to_censor=set(),
                 strip_final_period=False,
                 empath_analyze_function=None,
                 **kwargs):
        '''
        Parameters
        ----------
        empath_analyze_function: function (default=empath.Empath().analyze)
            Function that produces a dictionary mapping Empath categories to

        Other parameters from FeatsFromSpacyDoc.__init__
        '''
        if empath_analyze_function is None:
            try:
                import empath
            except ImportError:
                raise Exception(
                    "Please install the empath library to use FeatsFromSpacyDocAndEmpath."
                )
            self._empath_analyze_function = empath.Empath().analyze
        else:
            self._empath_analyze_function = partial(
                empath_analyze_function, kwargs={'tokenizer': 'bigram'})
        FeatsFromSpacyDoc.__init__(self, use_lemmas, entity_types_to_censor,
                                   tag_types_to_censor, strip_final_period)
Ejemplo n.º 2
0
 def __init__(self,
              use_lemmas=False,
              entity_types_to_censor=set(),
              tag_types_to_censor=set(),
              strip_final_period=False):
     FeatsFromSpacyDoc.__init__(self, use_lemmas, entity_types_to_censor,
                                tag_types_to_censor, strip_final_period)
     self._include_chunks = False
     self._rank_smoothing_constant = 0
Ejemplo n.º 3
0
 def __init__(self,
              use_lemmas=False,
              entity_types_to_censor=set(),
              entity_types_to_use=None,
              tag_types_to_censor=set(),
              strip_final_period=False):
     self._entity_types_to_use = entity_types_to_use
     FeatsFromSpacyDoc.__init__(self, use_lemmas, entity_types_to_censor,
                                tag_types_to_censor, strip_final_period)
Ejemplo n.º 4
0
 def __init__(self,
              topic_model,
              use_lemmas=False,
              entity_types_to_censor=set(),
              entity_types_to_use=None,
              tag_types_to_censor=set(),
              strip_final_period=False,
              keyword_processor_args={'case_sensitive': False}):
     self._keyword_processor = KeywordProcessor(**keyword_processor_args)
     self._topic_model = topic_model
     for keyphrase in reduce(lambda x, y: set(x) | set(y),
                             topic_model.values()):
         self._keyword_processor.add_keyword(keyphrase)
     FeatsFromSpacyDoc.__init__(self, use_lemmas, entity_types_to_censor,
                                tag_types_to_censor, strip_final_period)
     FeatsFromTopicModelBase.__init__(self, topic_model)
Ejemplo n.º 5
0
 def __init__(self, extractor=None, **args):
     import pyate
     self._extractor = pyate.combo_basic if extractor is None else extractor
     FeatsFromSpacyDoc.__init__(self, **args)