From 831cf50bb9220ad7537bb1539f7db263057ae263 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20Pogoda?= <mipo57@e-science.pl>
Date: Tue, 21 Feb 2023 11:42:47 +0100
Subject: [PATCH] Remove unused code

---
 src/annotation_mapping.py                   | 55 ---------------------
 src/input_parsers/wiktor_ner.py             |  5 +-
 tests/unit/input_parsers/test_ccl.py        |  2 -
 tests/unit/input_parsers/test_wiktor_ner.py |  1 -
 tests/unit/test_annotation_mapping.py       | 20 --------
 5 files changed, 1 insertion(+), 82 deletions(-)
 delete mode 100644 src/annotation_mapping.py
 delete mode 100644 tests/unit/test_annotation_mapping.py

diff --git a/src/annotation_mapping.py b/src/annotation_mapping.py
deleted file mode 100644
index 3a06c9c..0000000
--- a/src/annotation_mapping.py
+++ /dev/null
@@ -1,55 +0,0 @@
-from typing import Dict, List, Tuple, TypeVar
-
-T1 = TypeVar("T1")
-T2 = TypeVar("T2")
-
-
-def map_annotatios(
-    ref_annotations: List[Tuple[int, int, T1]],
-    all_annotations: Dict[str, List[Tuple[int, int, T2]]],
-    target_columns: List[str],
-) -> Dict[Tuple[int, int, T1], Dict[str, Tuple[int, int, T2]]]:
-    """Map annotations from target columns to reference annotations.
-
-    Example:
-        >> ref_annotations = [(0, 3, "Andrzej"), (7, 11, "psa")]
-        >> all_annotations = {
-        >>     "A": [(0, 3, "Andrzej"), (7, 11, "psa")],
-        >>     "B": [(0, 3, "AndrzejB"), (7, 11, "psaA")],
-        >>     "C": [(0, 3, "AndrzejC"), (8, 9, "psaC")],
-        >> }
-        >> target_columns = ["B", "C"]
-        >> map_annotatios(ref_annotations, all_annotations, target_columns)
-        {
-            (0, 3, "Andrzej"): {"B": (0, 3, "AndrzejB"), "C": (0, 3, "AndrzejC")},
-            (7, 11, "psa"): {
-               "B": (7, 11, "psaA"),
-            },
-        }
-
-    Args:
-        ref_annotations (List[Tuple[int, int, T1]]): Reference annotations.
-        all_annotations (Dict[str, List[Tuple[int, int, T2]]]): All annotations.
-        target_columns (List[str]): Target columns.
-
-    Returns:
-        Dict[Tuple[int, int, T1], Dict[str, Tuple[int, int, T2]]]: Mapped annotations.
-    """
-
-    result = dict()
-    index_map = dict()
-
-    for s_start, s_end, s_anno in ref_annotations:
-        result[(s_start, s_end, s_anno)] = dict()
-        index_map[(s_start, s_end)] = (s_start, s_end, s_anno)
-
-    for target_column in target_columns:
-        for t_start, t_end, t_anno in all_annotations[target_column]:
-            if (t_start, t_end) in index_map:
-                result[index_map[(t_start, t_end)]][target_column] = (
-                    t_start,
-                    t_end,
-                    t_anno,
-                )
-
-    return result
diff --git a/src/input_parsers/wiktor_ner.py b/src/input_parsers/wiktor_ner.py
index 463f32f..14e195d 100644
--- a/src/input_parsers/wiktor_ner.py
+++ b/src/input_parsers/wiktor_ner.py
@@ -1,9 +1,6 @@
-from typing import Dict, List, Tuple
-from lxml import etree
+from typing import List, Tuple
 import json
-from collections import defaultdict
 
-# from src.annotation_types_old import
 from src.input_parsers.interface import InputParser
 from src.annotations import Annotation, MorphosyntacticAnnotation, NerAnnotation
 
diff --git a/tests/unit/input_parsers/test_ccl.py b/tests/unit/input_parsers/test_ccl.py
index 80cc4f2..6032503 100644
--- a/tests/unit/input_parsers/test_ccl.py
+++ b/tests/unit/input_parsers/test_ccl.py
@@ -1,6 +1,4 @@
-# from src.annotation_types_old import AnnotationTypes
 from src.input_parsers.ccl import CCLInputParser
-from tempfile import NamedTemporaryFile
 from src.annotations import NerAnnotation, MorphosyntacticAnnotation
 
 example_ccl = """<?xml version="1.0" encoding="UTF-8"?>
diff --git a/tests/unit/input_parsers/test_wiktor_ner.py b/tests/unit/input_parsers/test_wiktor_ner.py
index 25e928b..04d8bf3 100644
--- a/tests/unit/input_parsers/test_wiktor_ner.py
+++ b/tests/unit/input_parsers/test_wiktor_ner.py
@@ -1,4 +1,3 @@
-# from src.annotation_types_old import AnnotationTypes
 from src.input_parsers.wiktor_ner import WiktorNERInputParser
 from src.annotations import NerAnnotation, MorphosyntacticAnnotation
 
diff --git a/tests/unit/test_annotation_mapping.py b/tests/unit/test_annotation_mapping.py
deleted file mode 100644
index a43133d..0000000
--- a/tests/unit/test_annotation_mapping.py
+++ /dev/null
@@ -1,20 +0,0 @@
-from src.annotation_mapping import map_annotatios
-
-
-def test_map_annotations():
-    ref_annotations = [(0, 3, "Andrzej"), (7, 11, "psa")]
-    all_annotations = {
-        "A": [(0, 3, "Andrzej"), (7, 11, "psa")],
-        "B": [(0, 3, "AndrzejB"), (7, 11, "psaA")],
-        "C": [(0, 3, "AndrzejC"), (8, 9, "psaC")],
-    }
-
-    result = map_annotatios(ref_annotations, all_annotations, ["B", "C"])
-    excepted = {
-        (0, 3, "Andrzej"): {"B": (0, 3, "AndrzejB"), "C": (0, 3, "AndrzejC")},
-        (7, 11, "psa"): {
-            "B": (7, 11, "psaA"),
-        },
-    }
-
-    assert result == excepted
-- 
GitLab