def __init__(self, language_name, max_num_threads=1, should_fine_tune_spacy_ner=False): super(self.__class__, self).__init__(language_name, max_num_threads) self.should_fine_tune_spacy_ner = should_fine_tune_spacy_ner self.nlp = self._load_nlp_model(language_name, should_fine_tune_spacy_ner) self.featurizer = SpacyFeaturizer(self.nlp) ensure_proper_language_model(self.nlp)
def __init__(self, config, language_name, max_num_threads=1): self.ensure_language_support(language_name) self.name = "spacy_sklearn" self.language_name = language_name self.max_num_threads = max_num_threads self.training_data = None self.nlp = spacy.load(self.language_name, parser=False, entity=False) self.featurizer = SpacyFeaturizer(self.nlp) self.intent_classifier = None self.entity_extractor = None ensure_proper_language_model(self.nlp)
def __init__(self, intent_classifier=None, entity_extractor=None, entity_synonyms=None, nlp=None): self.extractor = entity_extractor self.classifier = intent_classifier self.ent_synonyms = entity_synonyms self.nlp = nlp self.featurizer = SpacyFeaturizer(nlp) ensure_proper_language_model(nlp)
def __init__(self, entity_extractor=None, intent_classifier=None, language_name='en', **kwargs): self.extractor = None self.classifier = None self.nlp = spacy.load(language_name, parser=False, entity=False, matcher=False) self.featurizer = SpacyFeaturizer(self.nlp) ensure_proper_language_model(self.nlp) if intent_classifier: with open(intent_classifier, 'rb') as f: self.classifier = cloudpickle.load(f) if entity_extractor: self.extractor = SpacyEntityExtractor(self.nlp, entity_extractor)
def __init__(self, language_name, max_num_threads=1): super(self.__class__, self).__init__("spacy_sklearn", language_name, max_num_threads) self.nlp = spacy.load(self.language_name, parser=False, entity=False) self.featurizer = SpacyFeaturizer(self.nlp) ensure_proper_language_model(self.nlp)