PointerNetworkTaskModuleForEnd2EndRE: outsource remaining encoder-decoder specific logic
#181
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Move all remaining logic that is specific to the
relation_encoder_decoderintoBinaryRelationEncoderDecoder, i.e., the creation of constraints and parsing of partial / erroneous encodings.This PR:
AnnotationEncoderDecoder:build_decoding_constraintsparseBinaryRelationEncoderDecoderPointerNetworkTaskModuleForEnd2EndRE:build_constraintsbut usesself.relation_encoder_decoder.build_decoding_constraints(in._build_constraint) insteaddecode_relationsbut usesself.relation_encoder_decoder.parseinsteadNote that the implementations of
BinaryRelationEncoderDecoder.build_decoding_constraintsand.parseare not complete, they do not cover all options formodeand do not work with arbitraryhead_encoder_decoder/tail_encoder_decoder. But they cover the same amount of features that were implemented until now.This is a first step for a simplified version of #63. Especially, it is not breaking. Remaining steps would be:
MultiSpanEncoderDecoder,_post_prepareto use it asrelation_encoder_decoder(if the layer ofdocument_typewithspan_layer_nameis of typeLabeledMultiSpan), andcmp_src_rel(relation sorting) to work withLabeledMultiSpan.This will also allow to use this taskmodule as a blueprint for pointer based setups that handle any annotation structures. This will require to overwrite:
_post_prepare,encode_annotations, anddecode_annotations.