#5113 - Recommendations for multi-value features on document-level annotations broken#6010
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to fix recommendation visibility for document-level metadata when the target feature is multi-valued (e.g. StringArray), so suggestions whose labels already exist in the annotation are properly hidden.
Changes:
- Refactors
MetadataSuggestionSupport.hideSpanSuggestionsThatMatchAnnotationsto read values viaFeatureSupportRegistryand compare against iterable feature values. - Wires
FeatureSupportRegistryintoMetadataSuggestionSupportand its Spring auto-configuration. - Adds/updates unit tests to cover visibility behavior for single- and multi-valued metadata features.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
inception/inception-layer-docmetadata/src/test/java/de/tudarmstadt/ukp/inception/annotation/layer/document/recommender/MetadataSuggestionVisibilityCalculationTest.java |
Adds focused unit tests for suggestion visibility, including multi-value cases. |
inception/inception-layer-docmetadata/src/test/java/de/tudarmstadt/ukp/inception/annotation/layer/document/recommender/MetadataSuggestionExtractionTest.java |
Updates test wiring for the new MetadataSuggestionSupport constructor dependency. |
inception/inception-layer-docmetadata/src/main/java/de/tudarmstadt/ukp/inception/annotation/layer/document/recommender/MetadataSuggestionSupport.java |
Implements multi-value-aware matching via FeatureSupportRegistry and updates constructor. |
inception/inception-layer-docmetadata/src/main/java/de/tudarmstadt/ukp/inception/annotation/layer/document/config/DocumentMetadataLayerSupportAutoConfiguration.java |
Injects FeatureSupportRegistry into the MetadataSuggestionSupport bean. |
inception/inception-layer-docmetadata/pom.xml |
Adds inception-feature-string as a test dependency to support new tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
2c7054d to
ba3c25f
Compare
…notations broken - Rewrote `MetadataSuggestionSupport.hideSpanSuggestionsThatMatchAnnotations` to read existing feature values via `FeatureSupportRegistry` and iterate over `Iterable` values, so multi-valued features (e.g. `StringArray`) are properly compared against suggestion labels instead of falling through `getFeatureValueAsString` and never matching. - Injected `FeatureSupportRegistry` into `MetadataSuggestionSupport` and wired it through `DocumentMetadataLayerSupportAutoConfiguration`. - Added `MetadataSuggestionVisibilityCalculationTest` covering single-value match/no-match, singleton hide-all, learning-record rejection, and the previously broken multi-value match/no-match cases. - Updated `MetadataSuggestionExtractionTest` and added `inception-feature-string` test dependency for the new visibility test.
ba3c25f to
755bbbe
Compare
…notations broken - Return early from `hideSpanSuggestionsThatMatchAnnotations` when there are no suggestions or no annotations - Short-circuit singleton mode with a single `hideAll` per suggestion group, skipping the feature-support lookup and per-value iteration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What's in the PR
MetadataSuggestionSupport.hideSpanSuggestionsThatMatchAnnotationsto read existing feature values viaFeatureSupportRegistryand iterate overIterablevalues, so multi-valued features (e.g.StringArray) are properly compared against suggestion labels instead of falling throughgetFeatureValueAsStringand never matching.FeatureSupportRegistryintoMetadataSuggestionSupportand wired it throughDocumentMetadataLayerSupportAutoConfiguration.MetadataSuggestionVisibilityCalculationTestcovering single-value match/no-match, singleton hide-all, learning-record rejection, and the previously broken multi-value match/no-match cases.MetadataSuggestionExtractionTestand addedinception-feature-stringtest dependency for the new visibility test.How to test manually
Automatic testing
Documentation