Skip to content

Commit

Permalink
Fix the entity filtering of the transformer_recognizer.py analzye fun…
Browse files Browse the repository at this point in the history
…ction (#1403)
  • Loading branch information
andreas-eberle authored Jul 9, 2024
1 parent 2be6de1 commit 97a7e42
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
10 changes: 3 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@ All notable changes to this project will be documented in this file.

### Added
#### Analyzer
Recognizer for Spanish Foreigners Identity Code (NIE Numero de Identificacion de Extranjeros).

## [Unreleased]

### Added
#### Analyzer
Recognizer for Finnish Personal Identity Codes (Henkilötunnus).
* Recognizer for Spanish Foreigners Identity Code (NIE Numero de Identificacion de Extranjeros).
* Recognizer for Finnish Personal Identity Codes (Henkilötunnus).
* Fixed Transformer Recognizer Sample's analyze method to respect selected entities (@andreas-eberle).


## [2.2.353] - March 31st 2024
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def analyze(
"""
Analyze text using transformers model to produce NER tagging.
:param text : The text for analysis.
:param entities: Not working properly for this recognizer.
:param entities: The list of entities this recognizer is able to detect
:param nlp_artifacts: Not used by this recognizer.
:return: The list of Presidio RecognizerResult constructed from the recognized
transformers detections.
Expand All @@ -173,7 +173,7 @@ def analyze(

for res in ner_results:
res["entity_group"] = self.__check_label_transformer(res["entity_group"])
if not res["entity_group"]:
if not res["entity_group"] or res["entity_group"] not in entities
continue

if res["entity_group"] == self.id_entity_name:
Expand Down

0 comments on commit 97a7e42

Please sign in to comment.