Skip to content

Commit c421602

Browse files
committed
catch correct exception type
1 parent f8f51a6 commit c421602

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rasa/nlu/featurizers/sparse_featurizer/count_vectors_featurizer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def _check_attribute_vocabulary(self, attribute: Text) -> bool:
169169
"""Checks if trained vocabulary exists in attribute's count vectorizer."""
170170
try:
171171
return hasattr(self.vectorizers[attribute], "vocabulary_")
172-
except (AttributeError, TypeError):
172+
except (AttributeError, KeyError):
173173
return False
174174

175175
def _get_attribute_vocabulary(self, attribute: Text) -> Optional[Dict[Text, int]]:

0 commit comments

Comments
 (0)