From f963beec6ecb214d32cce06517766601f4b592f1 Mon Sep 17 00:00:00 2001 From: Daniel Ecer Date: Tue, 20 Oct 2020 20:16:24 +0200 Subject: [PATCH] moved annotators to annotation package (#162) --- sciencebeam_trainer_grobid_tools/annotation/__init__.py | 0 .../affiliation_address_annotator.py | 0 .../{structured_document => annotation}/annotator.py | 2 +- .../line_number_annotator.py | 0 .../{structured_document => annotation}/matching_utils.py | 0 .../reference_annotator.py | 4 ++-- .../segmentation_annotator.py | 0 .../simple_matching_annotator.py | 2 +- .../annotation/sub_tag_annotator.py | 2 +- .../auto_annotate_affiliation_address.py | 4 ++-- sciencebeam_trainer_grobid_tools/auto_annotate_reference.py | 4 ++-- .../auto_annotate_segmentation.py | 2 +- sciencebeam_trainer_grobid_tools/auto_annotate_utils.py | 6 +++--- tests/{structured_document => annotation}/annotator_test.py | 4 ++-- .../line_number_annotator_test.py | 2 +- .../matching_utils_test.py | 2 +- .../reference_annotator_test.py | 2 +- .../segmentation_annotator_test.py | 2 +- .../simple_matching_annotator_test.py | 2 +- 19 files changed, 20 insertions(+), 20 deletions(-) create mode 100644 sciencebeam_trainer_grobid_tools/annotation/__init__.py rename sciencebeam_trainer_grobid_tools/{structured_document => annotation}/affiliation_address_annotator.py (100%) rename sciencebeam_trainer_grobid_tools/{structured_document => annotation}/annotator.py (99%) rename sciencebeam_trainer_grobid_tools/{structured_document => annotation}/line_number_annotator.py (100%) rename sciencebeam_trainer_grobid_tools/{structured_document => annotation}/matching_utils.py (100%) rename sciencebeam_trainer_grobid_tools/{structured_document => annotation}/reference_annotator.py (98%) rename sciencebeam_trainer_grobid_tools/{structured_document => annotation}/segmentation_annotator.py (100%) rename sciencebeam_trainer_grobid_tools/{structured_document => annotation}/simple_matching_annotator.py (99%) rename tests/{structured_document => annotation}/annotator_test.py (97%) rename tests/{structured_document => annotation}/line_number_annotator_test.py (99%) rename tests/{structured_document => annotation}/matching_utils_test.py (95%) rename tests/{structured_document => annotation}/reference_annotator_test.py (98%) rename tests/{structured_document => annotation}/segmentation_annotator_test.py (99%) rename tests/{structured_document => annotation}/simple_matching_annotator_test.py (99%) diff --git a/sciencebeam_trainer_grobid_tools/annotation/__init__.py b/sciencebeam_trainer_grobid_tools/annotation/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/sciencebeam_trainer_grobid_tools/structured_document/affiliation_address_annotator.py b/sciencebeam_trainer_grobid_tools/annotation/affiliation_address_annotator.py similarity index 100% rename from sciencebeam_trainer_grobid_tools/structured_document/affiliation_address_annotator.py rename to sciencebeam_trainer_grobid_tools/annotation/affiliation_address_annotator.py diff --git a/sciencebeam_trainer_grobid_tools/structured_document/annotator.py b/sciencebeam_trainer_grobid_tools/annotation/annotator.py similarity index 99% rename from sciencebeam_trainer_grobid_tools/structured_document/annotator.py rename to sciencebeam_trainer_grobid_tools/annotation/annotator.py index bdb343fb..c4c34647 100644 --- a/sciencebeam_trainer_grobid_tools/structured_document/annotator.py +++ b/sciencebeam_trainer_grobid_tools/annotation/annotator.py @@ -7,7 +7,7 @@ strip_tag_prefix ) -from .grobid_training_tei import ( +from ..structured_document.grobid_training_tei import ( SUB_LEVEL, load_grobid_training_tei_structured_document, save_grobid_training_tei_structured_document, diff --git a/sciencebeam_trainer_grobid_tools/structured_document/line_number_annotator.py b/sciencebeam_trainer_grobid_tools/annotation/line_number_annotator.py similarity index 100% rename from sciencebeam_trainer_grobid_tools/structured_document/line_number_annotator.py rename to sciencebeam_trainer_grobid_tools/annotation/line_number_annotator.py diff --git a/sciencebeam_trainer_grobid_tools/structured_document/matching_utils.py b/sciencebeam_trainer_grobid_tools/annotation/matching_utils.py similarity index 100% rename from sciencebeam_trainer_grobid_tools/structured_document/matching_utils.py rename to sciencebeam_trainer_grobid_tools/annotation/matching_utils.py diff --git a/sciencebeam_trainer_grobid_tools/structured_document/reference_annotator.py b/sciencebeam_trainer_grobid_tools/annotation/reference_annotator.py similarity index 98% rename from sciencebeam_trainer_grobid_tools/structured_document/reference_annotator.py rename to sciencebeam_trainer_grobid_tools/annotation/reference_annotator.py index 9e9a1707..76bdd08b 100644 --- a/sciencebeam_trainer_grobid_tools/structured_document/reference_annotator.py +++ b/sciencebeam_trainer_grobid_tools/annotation/reference_annotator.py @@ -20,12 +20,12 @@ GrobidTrainingTeiStructuredDocument ) -from sciencebeam_trainer_grobid_tools.structured_document.simple_matching_annotator import ( +from sciencebeam_trainer_grobid_tools.annotation.simple_matching_annotator import ( get_extended_line_token_tags, to_inside_tag ) -from sciencebeam_trainer_grobid_tools.structured_document.matching_utils import ( +from sciencebeam_trainer_grobid_tools.annotation.matching_utils import ( JoinedText ) diff --git a/sciencebeam_trainer_grobid_tools/structured_document/segmentation_annotator.py b/sciencebeam_trainer_grobid_tools/annotation/segmentation_annotator.py similarity index 100% rename from sciencebeam_trainer_grobid_tools/structured_document/segmentation_annotator.py rename to sciencebeam_trainer_grobid_tools/annotation/segmentation_annotator.py diff --git a/sciencebeam_trainer_grobid_tools/structured_document/simple_matching_annotator.py b/sciencebeam_trainer_grobid_tools/annotation/simple_matching_annotator.py similarity index 99% rename from sciencebeam_trainer_grobid_tools/structured_document/simple_matching_annotator.py rename to sciencebeam_trainer_grobid_tools/annotation/simple_matching_annotator.py index 72ad41e1..5263ec10 100644 --- a/sciencebeam_trainer_grobid_tools/structured_document/simple_matching_annotator.py +++ b/sciencebeam_trainer_grobid_tools/annotation/simple_matching_annotator.py @@ -31,7 +31,7 @@ iter_fuzzy_search_all_index_ranges ) -from sciencebeam_trainer_grobid_tools.structured_document.matching_utils import ( +from sciencebeam_trainer_grobid_tools.annotation.matching_utils import ( SequenceWrapper, PendingSequences, SequencesText, diff --git a/sciencebeam_trainer_grobid_tools/annotation/sub_tag_annotator.py b/sciencebeam_trainer_grobid_tools/annotation/sub_tag_annotator.py index 5eab2f9a..45211f9e 100644 --- a/sciencebeam_trainer_grobid_tools/annotation/sub_tag_annotator.py +++ b/sciencebeam_trainer_grobid_tools/annotation/sub_tag_annotator.py @@ -9,7 +9,7 @@ GrobidTrainingTeiStructuredDocument ) -from sciencebeam_trainer_grobid_tools.structured_document.simple_matching_annotator import ( +from sciencebeam_trainer_grobid_tools.annotation.simple_matching_annotator import ( SimpleMatchingAnnotator ) diff --git a/sciencebeam_trainer_grobid_tools/auto_annotate_affiliation_address.py b/sciencebeam_trainer_grobid_tools/auto_annotate_affiliation_address.py index 0a99089d..778cbb4c 100644 --- a/sciencebeam_trainer_grobid_tools/auto_annotate_affiliation_address.py +++ b/sciencebeam_trainer_grobid_tools/auto_annotate_affiliation_address.py @@ -30,11 +30,11 @@ AnnotatorConfig ) -from .structured_document.simple_matching_annotator import ( +from .annotation.simple_matching_annotator import ( SimpleMatchingAnnotator ) -from .structured_document.affiliation_address_annotator import ( +from .annotation.affiliation_address_annotator import ( AffiliationAddressAnnotatorConfig, AffiliationAddressPostProcessingAnnotator ) diff --git a/sciencebeam_trainer_grobid_tools/auto_annotate_reference.py b/sciencebeam_trainer_grobid_tools/auto_annotate_reference.py index a49501cd..5ec71fb7 100644 --- a/sciencebeam_trainer_grobid_tools/auto_annotate_reference.py +++ b/sciencebeam_trainer_grobid_tools/auto_annotate_reference.py @@ -30,11 +30,11 @@ AnnotatorConfig ) -from .structured_document.simple_matching_annotator import ( +from .annotation.simple_matching_annotator import ( SimpleMatchingAnnotator ) -from .structured_document.reference_annotator import ( +from .annotation.reference_annotator import ( DEFAULT_IDNO_PREFIX_REGEX, ReferenceAnnotatorConfig, ReferencePostProcessingAnnotator diff --git a/sciencebeam_trainer_grobid_tools/auto_annotate_segmentation.py b/sciencebeam_trainer_grobid_tools/auto_annotate_segmentation.py index bdf6d5a0..8a1e42a1 100644 --- a/sciencebeam_trainer_grobid_tools/auto_annotate_segmentation.py +++ b/sciencebeam_trainer_grobid_tools/auto_annotate_segmentation.py @@ -21,7 +21,7 @@ ContainerNodePaths, DEFAULT_TAG_KEY ) -from .structured_document.segmentation_annotator import ( +from .annotation.segmentation_annotator import ( SegmentationAnnotator, SegmentationConfig, parse_segmentation_config diff --git a/sciencebeam_trainer_grobid_tools/auto_annotate_utils.py b/sciencebeam_trainer_grobid_tools/auto_annotate_utils.py index f53974c9..e7d53583 100644 --- a/sciencebeam_trainer_grobid_tools/auto_annotate_utils.py +++ b/sciencebeam_trainer_grobid_tools/auto_annotate_utils.py @@ -42,9 +42,9 @@ from .utils.string import comma_separated_str_to_list, parse_dict from .utils.regex import regex_change_name from .utils.xml import parse_xml -from .structured_document.annotator import annotate_structured_document +from .annotation.annotator import annotate_structured_document -from .structured_document.line_number_annotator import ( +from .annotation.line_number_annotator import ( DEFAULT_MIN_LINE_NUMBER_COUNT, DEFAULT_MAX_LINE_NUMBER_GAP, DEFAULT_LINE_NUMBER_RATIO_THRESHOLD, @@ -52,7 +52,7 @@ TextLineNumberAnnotator ) -from .structured_document.simple_matching_annotator import ( +from .annotation.simple_matching_annotator import ( SimpleMatchingAnnotator, SimpleSimpleMatchingConfig, get_simple_tag_config_map diff --git a/tests/structured_document/annotator_test.py b/tests/annotation/annotator_test.py similarity index 97% rename from tests/structured_document/annotator_test.py rename to tests/annotation/annotator_test.py index f06d5ddf..ed2a86cb 100644 --- a/tests/structured_document/annotator_test.py +++ b/tests/annotation/annotator_test.py @@ -14,11 +14,11 @@ DEFAULT_TAG_TO_TEI_PATH_MAPPING as _DEFAULT_TAG_TO_TEI_PATH_MAPPING ) -from sciencebeam_trainer_grobid_tools.structured_document.annotator import ( +from sciencebeam_trainer_grobid_tools.annotation.annotator import ( annotate_structured_document_inplace ) -from .grobid_training_tei_test import _tei +from ..structured_document.grobid_training_tei_test import _tei LOGGER = logging.getLogger(__name__) diff --git a/tests/structured_document/line_number_annotator_test.py b/tests/annotation/line_number_annotator_test.py similarity index 99% rename from tests/structured_document/line_number_annotator_test.py rename to tests/annotation/line_number_annotator_test.py index 672989f5..b70b5534 100644 --- a/tests/structured_document/line_number_annotator_test.py +++ b/tests/annotation/line_number_annotator_test.py @@ -8,7 +8,7 @@ ContainerNodePaths ) -from sciencebeam_trainer_grobid_tools.structured_document.line_number_annotator import ( +from sciencebeam_trainer_grobid_tools.annotation.line_number_annotator import ( TextLineNumberAnnotatorConfig, TextLineNumberAnnotator, DEFAULT_LINE_NO_TAG as LINE_NO_TAG diff --git a/tests/structured_document/matching_utils_test.py b/tests/annotation/matching_utils_test.py similarity index 95% rename from tests/structured_document/matching_utils_test.py rename to tests/annotation/matching_utils_test.py index 97499a02..f8d8a08d 100644 --- a/tests/structured_document/matching_utils_test.py +++ b/tests/annotation/matching_utils_test.py @@ -4,7 +4,7 @@ SimpleToken ) -from sciencebeam_trainer_grobid_tools.structured_document.matching_utils import ( +from sciencebeam_trainer_grobid_tools.annotation.matching_utils import ( join_with_index_ranges, SequenceWrapper ) diff --git a/tests/structured_document/reference_annotator_test.py b/tests/annotation/reference_annotator_test.py similarity index 98% rename from tests/structured_document/reference_annotator_test.py rename to tests/annotation/reference_annotator_test.py index 6fb9dd63..5bbbd0f1 100644 --- a/tests/structured_document/reference_annotator_test.py +++ b/tests/annotation/reference_annotator_test.py @@ -1,4 +1,4 @@ -from sciencebeam_trainer_grobid_tools.structured_document.reference_annotator import ( +from sciencebeam_trainer_grobid_tools.annotation.reference_annotator import ( DEFAULT_IDNO_PREFIX_REGEX, get_prefix_extended_token_tags, get_suffix_extended_token_tags, diff --git a/tests/structured_document/segmentation_annotator_test.py b/tests/annotation/segmentation_annotator_test.py similarity index 99% rename from tests/structured_document/segmentation_annotator_test.py rename to tests/annotation/segmentation_annotator_test.py index e4927d98..bca620dc 100644 --- a/tests/structured_document/segmentation_annotator_test.py +++ b/tests/annotation/segmentation_annotator_test.py @@ -12,7 +12,7 @@ I_TAG_PREFIX ) -from sciencebeam_trainer_grobid_tools.structured_document.segmentation_annotator import ( +from sciencebeam_trainer_grobid_tools.annotation.segmentation_annotator import ( parse_segmentation_config, SegmentationConfig, SegmentationAnnotator, diff --git a/tests/structured_document/simple_matching_annotator_test.py b/tests/annotation/simple_matching_annotator_test.py similarity index 99% rename from tests/structured_document/simple_matching_annotator_test.py rename to tests/annotation/simple_matching_annotator_test.py index ca6a0455..60e26202 100644 --- a/tests/structured_document/simple_matching_annotator_test.py +++ b/tests/annotation/simple_matching_annotator_test.py @@ -20,7 +20,7 @@ TargetAnnotation ) -from sciencebeam_trainer_grobid_tools.structured_document.simple_matching_annotator import ( +from sciencebeam_trainer_grobid_tools.annotation.simple_matching_annotator import ( SimpleTagConfig, SimpleMatchingAnnotator, get_extended_line_token_tags,