@@ -160,6 +160,7 @@ def get_recognizers(
160
160
all_possible_recognizers = copy .copy (self .recognizers )
161
161
if ad_hoc_recognizers :
162
162
all_possible_recognizers .extend (ad_hoc_recognizers )
163
+
163
164
to_return = set ()
164
165
if all_fields :
165
166
to_return = [
@@ -168,16 +169,16 @@ def get_recognizers(
168
169
if language == rec .supported_language
169
170
]
170
171
else :
171
- # filter out unwanted recognizers
172
172
all_entity_recognizers = dict ()
173
173
for rec in all_possible_recognizers :
174
- if type (rec .supported_entities ) == list and len (rec .supported_entities ) > 0 :
175
- for supported_entity in rec .supported_entities :
176
- all_entity_recognizers [supported_entity ] = all_entity_recognizers [supported_entity ].add (
177
- rec ) if supported_entity in all_entity_recognizers else {rec }
178
- elif type (rec .supported_entities ) == str :
179
- all_entity_recognizers [rec .supported_entities ] = all_entity_recognizers [rec .supported_entities ].add (
180
- rec ) if rec .supported_entities in all_entity_recognizers else {rec }
174
+ if language == rec .supported_language :
175
+ if type (rec .supported_entities ) == list and len (rec .supported_entities ) > 0 :
176
+ for supported_entity in rec .supported_entities :
177
+ all_entity_recognizers [supported_entity ] = all_entity_recognizers [supported_entity ].add (
178
+ rec ) if supported_entity in all_entity_recognizers else {rec }
179
+ elif type (rec .supported_entities ) == str :
180
+ all_entity_recognizers [rec .supported_entities ] = all_entity_recognizers [rec .supported_entities ].add (
181
+ rec ) if rec .supported_entities in all_entity_recognizers else {rec }
181
182
for entity in entities :
182
183
if entity in all_entity_recognizers :
183
184
to_return .update (all_entity_recognizers [entity ])
0 commit comments