From de2d83425802bc63d0e802fb5a17657e7c5450c3 Mon Sep 17 00:00:00 2001 From: Richard Eckart de Castilho Date: Mon, 3 Apr 2023 17:43:59 +0200 Subject: [PATCH] #3909 - Accept best button missing from recommendation sidebar - Move "accept best" buttons (and other buttons) out of the results group so they are visible even when no evaluation results are available --- .../service/RecommendationServiceImpl.java | 8 +++---- .../sidebar/RecommenderInfoPanel.html | 22 +++++++++---------- .../sidebar/RecommenderInfoPanel.java | 14 +++++++----- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/inception/inception-recommendation/src/main/java/de/tudarmstadt/ukp/inception/recommendation/service/RecommendationServiceImpl.java b/inception/inception-recommendation/src/main/java/de/tudarmstadt/ukp/inception/recommendation/service/RecommendationServiceImpl.java index 507d62fae70..7e64bbb810c 100644 --- a/inception/inception-recommendation/src/main/java/de/tudarmstadt/ukp/inception/recommendation/service/RecommendationServiceImpl.java +++ b/inception/inception-recommendation/src/main/java/de/tudarmstadt/ukp/inception/recommendation/service/RecommendationServiceImpl.java @@ -1833,8 +1833,8 @@ private static Optional getOffsetsAnchoredOnSentences(CAS aOriginalCas, if (sentences.isEmpty()) { // This can happen if a recommender uses different token boundaries (e.g. if a // remote service performs its own tokenization). We might be smart here by - // looking for overlapping sentences instead of contained sentences. - LOG.trace("Discarding suggestion because no covering sentences were found: {}", + // looking for overlapping sentences instead of covered sentences. + LOG.trace("Discarding suggestion because no covered sentences were found: {}", aPredictedAnnotation); return Optional.empty(); } @@ -1879,8 +1879,8 @@ static Optional getOffsetsAnchoredOnTokens(CAS aOriginalCas, // This can happen if a recommender uses different token boundaries (e.g. if a // remote service performs its own tokenization). We might be smart here by - // looking for overlapping tokens instead of contained tokens. - LOG.trace("Discarding suggestion because no covering tokens were found: {}", + // looking for overlapping tokens instead of covered tokens. + LOG.trace("Discarding suggestion because no covered tokens were found: {}", aPredictedAnnotation); return Optional.empty(); } diff --git a/inception/inception-recommendation/src/main/java/de/tudarmstadt/ukp/inception/recommendation/sidebar/RecommenderInfoPanel.html b/inception/inception-recommendation/src/main/java/de/tudarmstadt/ukp/inception/recommendation/sidebar/RecommenderInfoPanel.html index ae19ddc30f0..0468196f670 100644 --- a/inception/inception-recommendation/src/main/java/de/tudarmstadt/ukp/inception/recommendation/sidebar/RecommenderInfoPanel.html +++ b/inception/inception-recommendation/src/main/java/de/tudarmstadt/ukp/inception/recommendation/sidebar/RecommenderInfoPanel.html @@ -63,17 +63,17 @@ - + +
diff --git a/inception/inception-recommendation/src/main/java/de/tudarmstadt/ukp/inception/recommendation/sidebar/RecommenderInfoPanel.java b/inception/inception-recommendation/src/main/java/de/tudarmstadt/ukp/inception/recommendation/sidebar/RecommenderInfoPanel.java index b508d230fc4..dde339ad8dd 100644 --- a/inception/inception-recommendation/src/main/java/de/tudarmstadt/ukp/inception/recommendation/sidebar/RecommenderInfoPanel.java +++ b/inception/inception-recommendation/src/main/java/de/tudarmstadt/ukp/inception/recommendation/sidebar/RecommenderInfoPanel.java @@ -168,13 +168,17 @@ protected void populateItem(ListItem item) resultsContainer.add(new Label("testSampleCount", evalResult.map(EvaluationResult::getTestSetSize).orElse(0))); - resultsContainer.add(new LambdaAjaxLink("acceptBest", + item.add(resultsContainer); + + item.add(new LambdaAjaxLink("acceptBest", _tgt -> actionAcceptBest(_tgt, recommender)) .setVisible(evaluatedRecommender.map(EvaluatedRecommender::isActive) .orElse(false))); - resultsContainer.add(new LambdaAjaxLink("showDetails", - _tgt -> actionShowDetails(_tgt, recommender))); + item.add(new LambdaAjaxLink("showDetails", + _tgt -> actionShowDetails(_tgt, recommender)) + .setVisible(evalResult.map(r -> !r.isEvaluationSkipped()) + .orElse(evalResult.isPresent()))); AjaxDownloadLink exportModel = new AjaxDownloadLink("exportModel", LoadableDetachableModel.of(() -> exportModelName(recommender)), @@ -183,9 +187,7 @@ protected void populateItem(ListItem item) () -> recommendationService.getRecommenderFactory(recommender).isPresent() && recommendationService.getRecommenderFactory(recommender).get() .isModelExportSupported())); - resultsContainer.add(exportModel); - - item.add(resultsContainer); + item.add(exportModel); item.add(new Label("noEvaluationMessage", evaluatedRecommender.map(EvaluatedRecommender::getReasonForState)