Skip to content

Commit

Permalink
#34 - Improve and refactor Active Learning code
Browse files Browse the repository at this point in the history
- Further reduced code
- Some renaming
- Formatting
- Instead of replacing the layer dropdown after session start, just disable it
- Use constant from RecommenderEditorExtension instead of redefining it
  • Loading branch information
reckart committed Apr 11, 2018
1 parent 388a30b commit 3e78af0
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 131 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@
import org.apache.uima.cas.text.AnnotationFS;
import org.apache.uima.fit.util.CasUtil;
import org.apache.uima.jcas.JCas;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import de.tudarmstadt.ukp.clarin.webanno.api.AnnotationSchemaService;
import de.tudarmstadt.ukp.clarin.webanno.api.DocumentService;
import de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.AnnotatorState;
import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationLayer;
Expand All @@ -49,26 +46,23 @@
public class ActiveLearningRecommender
implements Serializable
{
private static final Logger logger = LoggerFactory.getLogger(ActiveLearningSidebar.class);
private static final long serialVersionUID = -2308436775710912029L;

private RecommendationService recommendationService;
private List<AnnotationObject> recommendations;
private List<List<AnnotationObject>> listOfRecommendationsForEachToken;
private AnnotatorState annotatorState;
private AnnotationLayer selectedLayer;
private AnnotationSchemaService annotationService;
private LearningRecordService learningRecordService;
private DocumentService documentService;

public ActiveLearningRecommender(RecommendationService recommendationService,
AnnotatorState annotatorState, AnnotationLayer selectedLayer,
AnnotationSchemaService annotationService, LearningRecordService recordService)
LearningRecordService recordService)
{
this.recommendationService = recommendationService;
this.annotatorState = annotatorState;
this.selectedLayer = selectedLayer;
this.annotationService = annotationService;
this.learningRecordService = recordService;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<h3 class="panel-title">Active Learning</h3>
</div>
<div class="panel-body flex-v-container">
<form class="panel panel-default panel-small" wicket:id="layerSelectionForm">
<form class="panel panel-default panel-small" wicket:id="sessionControlForm">
<div class="panel-heading">
<h3 class="panel-title">Session</h3>
</div>
Expand All @@ -33,7 +33,6 @@ <h3 class="panel-title">Session</h3>
<label class="col-sm-3 control-label">Layer</label>
<div class="col-sm-9">
<select class="form-control" wicket:id="selectLayer"></select>
<span class="form-control" wicket:id="showSelectedLayer"></span>
</div>
</div>
</div>
Expand Down
Loading

0 comments on commit 3e78af0

Please sign in to comment.