From d62da8a9d7d52092654aef4962b14237ac6a0f15 Mon Sep 17 00:00:00 2001
From: pwalkow <pawel.walkowiak@hotmail.com>
Date: Wed, 22 Nov 2023 11:07:49 +0100
Subject: [PATCH] Fix

---
 src/dictionaries/morphosyntactic/ner_file.py | 3 ++-
 src/replacers/ner_replacer.py                | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/dictionaries/morphosyntactic/ner_file.py b/src/dictionaries/morphosyntactic/ner_file.py
index 8fe2a78..f31dde7 100644
--- a/src/dictionaries/morphosyntactic/ner_file.py
+++ b/src/dictionaries/morphosyntactic/ner_file.py
@@ -93,7 +93,8 @@ class NERFileMorphosyntacticDictionary(MorphosyntacticDictionary):
             if original_entry_type_name in self._dictionary:
                 entry_type = original_entry_type_name
 
-                if morpho_tag in self._dictionary[entry_type]:
+                if morpho_tag in self._dictionary[entry_type] \
+                        and morpho_tag in self._dictionary[entry_type]:
                     lemma = random.choice(
                         list(self._dictionary[entry_type][morpho_tag].keys())
                     )
diff --git a/src/replacers/ner_replacer.py b/src/replacers/ner_replacer.py
index fb212b3..b2d5564 100644
--- a/src/replacers/ner_replacer.py
+++ b/src/replacers/ner_replacer.py
@@ -61,7 +61,7 @@ class NERReplacer(ReplacerInterface):
                 )
                 morpho_detections[key].append(detection)
             else:
-                key = (text[start:end], detection.TYPE_NAME)
+                key = (text[start:end], detection_entry.TYPE_NAME)
                 non_morpho_detections[key].append(detection)
 
         # Replace morphosyntactic detections
-- 
GitLab