Skip to content

Commit

Permalink
Merge pull request #4432 from inception-project/feature/2696-Document…
Browse files Browse the repository at this point in the history
…-level-recommendations

#2696 - Document-level recommendations
  • Loading branch information
reckart authored Jan 8, 2024
2 parents 5676615 + 7ab7476 commit cd7b6ab
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
4 changes: 4 additions & 0 deletions inception/inception-layer-docmetadata/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-recommendation-api</artifactId>
</dependency>
<dependency>
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-recommendation</artifactId>
</dependency>

<dependency>
<groupId>org.apache.uima</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
*/
package de.tudarmstadt.ukp.inception.ui.core.docanno.config;

import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.ApplicationEventPublisher;
Expand All @@ -26,6 +28,7 @@
import de.tudarmstadt.ukp.inception.documents.api.DocumentService;
import de.tudarmstadt.ukp.inception.recommendation.api.LearningRecordService;
import de.tudarmstadt.ukp.inception.recommendation.api.RecommendationService;
import de.tudarmstadt.ukp.inception.recommendation.config.RecommenderServiceAutoConfiguration;
import de.tudarmstadt.ukp.inception.schema.api.AnnotationSchemaService;
import de.tudarmstadt.ukp.inception.schema.api.feature.FeatureSupportRegistry;
import de.tudarmstadt.ukp.inception.schema.api.layer.LayerSupportRegistry;
Expand All @@ -40,6 +43,7 @@
* Provides support for document-level annotations.
*/
@Configuration
@AutoConfigureAfter(RecommenderServiceAutoConfiguration.class)
@EnableConfigurationProperties(DocumentMetadataLayerSupportPropertiesImpl.class)
public class DocumentMetadataLayerSupportAutoConfiguration
{
Expand Down Expand Up @@ -85,6 +89,7 @@ public DocumentMetadataAnnotationActionUndoSupport documentMetadataAnnotationAct

@Bean
@ConditionalOnProperty(prefix = "documentmetadata", name = "enabled", havingValue = "true", matchIfMissing = true)
@ConditionalOnBean(RecommendationService.class)
public MetadataSuggestionSupport metadataSuggestionSupport(
RecommendationService aRecommendationService,
LearningRecordService aLearningRecordService,
Expand Down
4 changes: 0 additions & 4 deletions inception/inception-recommendation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,6 @@
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-support-bootstrap</artifactId>
</dependency>
<dependency>
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-layer-docmetadata</artifactId>
</dependency>

<dependency>
<groupId>org.dkpro.core</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@
import de.tudarmstadt.ukp.clarin.webanno.security.UserDao;
import de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Sentence;
import de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Token;
import de.tudarmstadt.ukp.inception.annotation.layer.relation.RelationLayerSupport;
import de.tudarmstadt.ukp.inception.annotation.layer.span.SpanLayerSupport;
import de.tudarmstadt.ukp.inception.annotation.layer.chain.ChainLayerSupport;
import de.tudarmstadt.ukp.inception.recommendation.api.RecommendationService;
import de.tudarmstadt.ukp.inception.recommendation.api.RecommenderFactoryRegistry;
import de.tudarmstadt.ukp.inception.recommendation.api.model.Recommender;
Expand All @@ -73,7 +72,6 @@
import de.tudarmstadt.ukp.inception.support.lambda.LambdaModelAdapter;
import de.tudarmstadt.ukp.inception.support.spring.ApplicationEventPublisherHolder;
import de.tudarmstadt.ukp.inception.support.wicket.ModelChangedVisitor;
import de.tudarmstadt.ukp.inception.ui.core.docanno.layer.DocumentMetadataLayerSupport;

public class RecommenderEditorPanel
extends Panel
Expand Down Expand Up @@ -408,11 +406,9 @@ protected void onModelChanged()
private List<AnnotationLayer> listLayers()
{
return annotationSchemaService.listAnnotationLayer(projectModel.getObject()).stream() //
.filter(layer -> (SpanLayerSupport.TYPE.equals(layer.getType())
|| RelationLayerSupport.TYPE.equals(layer.getType()) //
|| DocumentMetadataLayerSupport.TYPE.equals(layer.getType())) //
&& !(Token._TypeName.equals(layer.getName())
|| Sentence._TypeName.equals(layer.getName())))
.filter(layer -> !ChainLayerSupport.TYPE.equals(layer.getType()) && //
!Token._TypeName.equals(layer.getName()) && //
!Sentence._TypeName.equals(layer.getName()))
.toList();
}

Expand Down

0 comments on commit cd7b6ab

Please sign in to comment.