Skip to content

Commit

Permalink
rename to model to match recipe params (RasaHQ#10047)
Browse files Browse the repository at this point in the history
  • Loading branch information
wochinge authored Nov 2, 2021
1 parent d2eb3a7 commit 6df732c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -605,19 +605,19 @@ def _get_featurized_attribute(
return [], []

def train(
self, training_data: TrainingData, spacy_nlp: Optional[SpacyModel] = None,
self, training_data: TrainingData, model: Optional[SpacyModel] = None,
) -> Resource:
"""Trains the featurizer.
Take parameters from config and
construct a new count vectorizer using the sklearn framework.
"""
if spacy_nlp is not None:
if model is not None:
# create spacy lemma_ for OOV_words
self.OOV_words = [
t.lemma_ if self.use_lemma else t.text
for w in self.OOV_words
for t in spacy_nlp.model(w)
for t in model.model(w)
]

# process sentences and collect data for all attributes
Expand Down
2 changes: 1 addition & 1 deletion tests/nlu/featurizers/test_count_vectors_featurizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ def test_count_vector_featurizer_use_lemma(
spacy_tokenizer.process([train_message])
spacy_tokenizer.process([test_message])

ftr.train(TrainingData([train_message]), spacy_nlp=SpacyModel(spacy_nlp, "en"))
ftr.train(TrainingData([train_message]), model=SpacyModel(spacy_nlp, "en"))

ftr.process([test_message])

Expand Down

0 comments on commit 6df732c

Please sign in to comment.