Skip to content

Commit

Permalink
Merge pull request #5116 from inception-project/bugfix/5115-Suggestio…
Browse files Browse the repository at this point in the history
…ns-for-concept-features-never-hidden-due-to-overlapping

#5115 - Suggestions for concept features never hidden due to overlapping
  • Loading branch information
reckart authored Nov 1, 2024
2 parents 6632342 + f2c7239 commit 8ef6b4d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import static de.tudarmstadt.ukp.inception.recommendation.api.model.AnnotationSuggestion.FLAG_ALL;
import static de.tudarmstadt.ukp.inception.recommendation.api.model.AnnotationSuggestion.FLAG_OVERLAP;
import static org.apache.uima.cas.CAS.TYPE_NAME_STRING;

import java.lang.invoke.MethodHandles;
import java.util.ArrayList;
Expand Down Expand Up @@ -83,7 +84,7 @@ public boolean accepts(Recommender aContext)
}

var feature = aContext.getFeature();
if (CAS.TYPE_NAME_STRING.equals(feature.getType()) || feature.isVirtualFeature()) {
if (TYPE_NAME_STRING.equals(feature.getType()) || feature.isVirtualFeature()) {
return true;
}

Expand Down Expand Up @@ -213,6 +214,7 @@ private void hideSpanSuggestionsThatMatchAnnotations(boolean singleton,
{

for (var annotation : aAnnotations) {
// FIXME: This will not work for multi-valued features
var label = annotation.getFeatureValueAsString(aFeat);

if (label == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ public <T extends AnnotationSuggestion> void calculateSuggestionVisibility(Strin

var position = group.getPosition();

// FIXME: Looks like we need to implement not hiding relations if stacking is
// enabled.

// If any annotation at this position has a non-null label for this feature,
// then we hide the suggestion group
for (var annotationFS : groupedAnnotations.get(position)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,10 @@ private void hideSpanSuggestionsThatOverlapWithAnnotations(
var group = suggestions.get(suggestionOffset);
for (var annotation : annotations.get(annotationOffset)) {
Iterable<Object> labelObjects;
var value = featureSupportRegistry.findExtension(feature).get()
.getFeatureValue(feature, annotation);
var featureSupport = featureSupportRegistry.findExtension(feature).get();
var wrappedValue = featureSupport.getFeatureValue(feature, annotation);
var value = featureSupport.unwrapFeatureValue(feature, annotation.getCAS(),
wrappedValue);
if (value instanceof Iterable iterableValues) {
labelObjects = iterableValues;
}
Expand Down

0 comments on commit 8ef6b4d

Please sign in to comment.