Tabnine Logo
AnnotationSuggestion.getEnd
Code IndexAdd Tabnine to your IDE (free)

How to use
getEnd
method
in
de.tudarmstadt.ukp.inception.recommendation.api.model.AnnotationSuggestion

Best Java code snippets using de.tudarmstadt.ukp.inception.recommendation.api.model.AnnotationSuggestion.getEnd (Showing top 20 results out of 315)

origin: inception-project/inception

/**
 * Returns the prediction used to generate the VID
 */
public Optional<AnnotationSuggestion> getPrediction(SourceDocument aDocument, int aBegin,
    int aEnd, String aLabel)
{
  return predictions.values().stream()
      .filter(f -> f.getDocumentName().equals(aDocument.getName()))
      .filter(f -> f.getBegin() == aBegin && f.getEnd() == aEnd)
      .filter(f -> f.getLabel().equals(aLabel))
      .max(Comparator.comparingInt(AnnotationSuggestion::getId));
}

origin: de.tudarmstadt.ukp.inception.app/inception-active-learning

private void setHighlight(AnnotationSuggestion aSuggestion)
{
  if (protectHighlight) {
    LOG.trace("Active learning sidebar not updating protected highlights");
    protectHighlight = false;
    return;
  }
  
  LOG.trace("Active learning sidebar set highlight suggestion: {}", aSuggestion);
  highlightVID = aSuggestion.getVID();
  highlightSpan = new Offset(aSuggestion.getBegin(), aSuggestion.getEnd());
  highlightDocumentName = aSuggestion.getDocumentName();
}

origin: inception-project/inception

private void setHighlight(AnnotationSuggestion aSuggestion)
{
  if (protectHighlight) {
    LOG.trace("Active learning sidebar not updating protected highlights");
    protectHighlight = false;
    return;
  }
  
  LOG.trace("Active learning sidebar set highlight suggestion: {}", aSuggestion);
  highlightVID = aSuggestion.getVID();
  highlightSpan = new Offset(aSuggestion.getBegin(), aSuggestion.getEnd());
  highlightDocumentName = aSuggestion.getDocumentName();
}

origin: inception-project/inception

public GroupKey(AnnotationSuggestion aSuggestion)
{
  super();
  begin = aSuggestion.getBegin();
  end = aSuggestion.getEnd();
  feature = aSuggestion.getFeature();
  layerId = aSuggestion.getLayerId();
}
origin: de.tudarmstadt.ukp.inception.app/inception-active-learning

private void actionJumpToSuggestion(AjaxRequestTarget aTarget)
  throws IOException
{
  ActiveLearningUserState alState = alStateModel.getObject();
  
  AnnotationSuggestion suggestion = alState.getSuggestion().get();
  if (LOG.isDebugEnabled()) {
    LOG.debug("Active suggestion: {}", suggestion);
    Optional<AnnotationSuggestion> updatedSuggestion = getMatchingSuggestion(
        activeLearningService.getSuggestions(getModelObject().getUser(),
            alState.getLayer()),
        suggestion).stream().findFirst();
    updatedSuggestion.ifPresent(s -> LOG.debug("Update suggestion: {}", s));
  }
  actionShowSelectedDocument(aTarget,
      documentService.getSourceDocument(this.getModelObject().getProject(),
          suggestion.getDocumentName()),
      suggestion.getBegin(), suggestion.getEnd());
  setHighlight(suggestion);
}
origin: inception-project/inception

private void actionJumpToSuggestion(AjaxRequestTarget aTarget)
  throws IOException
{
  ActiveLearningUserState alState = alStateModel.getObject();
  
  AnnotationSuggestion suggestion = alState.getSuggestion().get();
  if (LOG.isDebugEnabled()) {
    LOG.debug("Active suggestion: {}", suggestion);
    Optional<AnnotationSuggestion> updatedSuggestion = getMatchingSuggestion(
        activeLearningService.getSuggestions(getModelObject().getUser(),
            alState.getLayer()),
        suggestion).stream().findFirst();
    updatedSuggestion.ifPresent(s -> LOG.debug("Update suggestion: {}", s));
  }
  actionShowSelectedDocument(aTarget,
      documentService.getSourceDocument(this.getModelObject().getProject(),
          suggestion.getDocumentName()),
      suggestion.getBegin(), suggestion.getEnd());
  setHighlight(suggestion);
}
origin: inception-project/inception

Validate.isTrue(
    representative.getBegin() == aSuggestion.getBegin() && 
    representative.getEnd() == aSuggestion.getEnd(),
    "All suggestions in a group must be at the same position: expected [%d-%d] but got [%d-%d]",
    representative.getBegin(), representative.getEnd(), aSuggestion.getBegin(),
    aSuggestion.getEnd());
Validate.isTrue(representative.getDocumentName().equals(aSuggestion.getDocumentName()),
    "All suggestions in a group must come from the same document: expected [%s] but got [%s]",
origin: de.tudarmstadt.ukp.inception.app/inception-active-learning

private List<AnnotationSuggestion> getMatchingSuggestion(List<SuggestionGroup> aSuggestions,
    AnnotationSuggestion aSuggestion)
{
  return getMatchingSuggestion(aSuggestions, aSuggestion.getDocumentName(),
      aSuggestion.getLayerId(), aSuggestion.getFeature(), aSuggestion.getBegin(),
      aSuggestion.getEnd(), aSuggestion.getLabel());
}
origin: inception-project/inception

private List<AnnotationSuggestion> getMatchingSuggestion(List<SuggestionGroup> aSuggestions,
    AnnotationSuggestion aSuggestion)
{
  return getMatchingSuggestion(aSuggestions, aSuggestion.getDocumentName(),
      aSuggestion.getLayerId(), aSuggestion.getFeature(), aSuggestion.getBegin(),
      aSuggestion.getEnd(), aSuggestion.getLabel());
}
origin: de.tudarmstadt.ukp.inception.app/inception-active-learning

@Override
public boolean isSuggestionVisible(LearningRecord aRecord)
{
  User user = userService.get(aRecord.getUser());
  List<SuggestionGroup> suggestions = getSuggestions(user,
      aRecord.getLayer());
  for (SuggestionGroup listOfAO : suggestions) {
    if (listOfAO.stream().anyMatch(suggestion -> 
        suggestion.getDocumentName().equals(aRecord.getSourceDocument().getName()) && 
        suggestion.getFeature().equals(aRecord.getAnnotationFeature().getName()) && 
        suggestion.getLabel().equals(aRecord.getAnnotation()) && 
        suggestion.getBegin() == aRecord.getOffsetCharacterBegin() && 
        suggestion.getEnd() == aRecord.getOffsetCharacterEnd() &&
        suggestion.isVisible())
    ) {
      return true;
    }
  }
  return false;
}

origin: inception-project/inception

@Override
public boolean isSuggestionVisible(LearningRecord aRecord)
{
  User user = userService.get(aRecord.getUser());
  List<SuggestionGroup> suggestions = getSuggestions(user,
      aRecord.getLayer());
  for (SuggestionGroup listOfAO : suggestions) {
    if (listOfAO.stream().anyMatch(suggestion -> 
        suggestion.getDocumentName().equals(aRecord.getSourceDocument().getName()) && 
        suggestion.getFeature().equals(aRecord.getAnnotationFeature().getName()) && 
        suggestion.getLabel().equals(aRecord.getAnnotation()) && 
        suggestion.getBegin() == aRecord.getOffsetCharacterBegin() && 
        suggestion.getEnd() == aRecord.getOffsetCharacterEnd() &&
        suggestion.isVisible())
    ) {
      return true;
    }
  }
  return false;
}

origin: de.tudarmstadt.ukp.inception.app/inception-active-learning

.filter(r -> r.getSourceDocument().getName().equals(s.getDocumentName())
    && r.getOffsetCharacterBegin() == s.getBegin()
    && r.getOffsetCharacterEnd() == s.getEnd()
    && r.getAnnotation().equals(s.getLabel()))
.forEach(record -> {
origin: inception-project/inception

.filter(r -> r.getSourceDocument().getName().equals(s.getDocumentName())
    && r.getOffsetCharacterBegin() == s.getBegin()
    && r.getOffsetCharacterEnd() == s.getEnd()
    && r.getAnnotation().equals(s.getLabel()))
.forEach(record -> {
origin: de.tudarmstadt.ukp.inception.app/inception-active-learning

@Override
public String getDetails(ActiveLearningSuggestionOfferedEvent aEvent)
{
  try {
    Details details = new Details();
    details.ann = new AnnotationDetails();
    details.ann.setBegin(aEvent.getCurrentRecommendation().getBegin());
    details.ann.setEnd(aEvent.getCurrentRecommendation().getEnd());
    details.ann.setText(aEvent.getCurrentRecommendation().getCoveredText());
    details.ann.setType(aEvent.getLayer().getName());
    details.annotationFeature = aEvent.getAnnotationFeature();
    details.currentLabel = aEvent.getCurrentRecommendation().getLabel();
    details.confidence = aEvent.getCurrentRecommendation().getConfidence();
    details.recommenderId = aEvent.getCurrentRecommendation().getRecommenderId();
    List<String> allLabelList = aEvent.getAllRecommendations().stream()
      .map(ao -> ao.getLabel()).collect(Collectors.toList());
    details.allLabels = String.join(", ", allLabelList);
    return JSONUtil.toJsonString(details);
  }
  catch (IOException e) {
    log.error("Unable to log event [{}]", aEvent, e);
    return "<ERROR>";
  }
}
origin: inception-project/inception

@Override
public String getDetails(ActiveLearningSuggestionOfferedEvent aEvent)
{
  try {
    Details details = new Details();
    details.ann = new AnnotationDetails();
    details.ann.setBegin(aEvent.getCurrentRecommendation().getBegin());
    details.ann.setEnd(aEvent.getCurrentRecommendation().getEnd());
    details.ann.setText(aEvent.getCurrentRecommendation().getCoveredText());
    details.ann.setType(aEvent.getLayer().getName());
    details.annotationFeature = aEvent.getAnnotationFeature();
    details.currentLabel = aEvent.getCurrentRecommendation().getLabel();
    details.confidence = aEvent.getCurrentRecommendation().getConfidence();
    details.recommenderId = aEvent.getCurrentRecommendation().getRecommenderId();
    List<String> allLabelList = aEvent.getAllRecommendations().stream()
      .map(ao -> ao.getLabel()).collect(Collectors.toList());
    details.allLabels = String.join(", ", allLabelList);
    return JSONUtil.toJsonString(details);
  }
  catch (IOException e) {
    log.error("Unable to log event [{}]", aEvent, e);
    return "<ERROR>";
  }
}
origin: de.tudarmstadt.ukp.inception.app/inception-active-learning

@Override
public String getDetails(ActiveLearningRecommendationEvent aEvent)
{
  try {
    ActiveLearningRecommendationDetails details = new ActiveLearningRecommendationDetails();
    details.ann = new AnnotationDetails();
    details.ann.setBegin(aEvent.getCurrentRecommendation().getBegin());
    details.ann.setEnd(aEvent.getCurrentRecommendation().getEnd());
    details.ann.setText(aEvent.getCurrentRecommendation().getCoveredText());
    details.ann.setType(aEvent.getLayer().getName());
    details.annotationFeature = aEvent.getAnnotationFeature();
    details.userAction = aEvent.getAction();
    details.currentLabel = aEvent.getCurrentRecommendation().getLabel();
    details.confidence = aEvent.getCurrentRecommendation().getConfidence();
    details.recommenderId = aEvent.getCurrentRecommendation().getRecommenderId();
    List<String> allLabelList = aEvent.getAllRecommendations().stream()
      .map(ao -> ao.getLabel()).collect(Collectors.toList());
    details.allLabels = String.join(", ", allLabelList);
    return JSONUtil.toJsonString(details);
  }
  catch (IOException e) {
    log.error("Unable to log event [{}]", aEvent, e);
    return "<ERROR>";
  }
}
origin: inception-project/inception

@Override
public String getDetails(ActiveLearningRecommendationEvent aEvent)
{
  try {
    ActiveLearningRecommendationDetails details = new ActiveLearningRecommendationDetails();
    details.ann = new AnnotationDetails();
    details.ann.setBegin(aEvent.getCurrentRecommendation().getBegin());
    details.ann.setEnd(aEvent.getCurrentRecommendation().getEnd());
    details.ann.setText(aEvent.getCurrentRecommendation().getCoveredText());
    details.ann.setType(aEvent.getLayer().getName());
    details.annotationFeature = aEvent.getAnnotationFeature();
    details.userAction = aEvent.getAction();
    details.currentLabel = aEvent.getCurrentRecommendation().getLabel();
    details.confidence = aEvent.getCurrentRecommendation().getConfidence();
    details.recommenderId = aEvent.getCurrentRecommendation().getRecommenderId();
    List<String> allLabelList = aEvent.getAllRecommendations().stream()
      .map(ao -> ao.getLabel()).collect(Collectors.toList());
    details.allLabels = String.join(", ", allLabelList);
    return JSONUtil.toJsonString(details);
  }
  catch (IOException e) {
    log.error("Unable to log event [{}]", aEvent, e);
    return "<ERROR>";
  }
}
origin: inception-project/inception

&& record.getOffsetCharacterEnd() == aSuggestion.getEnd()
&& record.getAnnotation().equals(aSuggestion.getLabel()))
origin: de.tudarmstadt.ukp.inception.app/inception-active-learning

private void writeLearningRecordInDatabaseAndEventLog(AnnotationSuggestion aSuggestion,
    LearningRecordType aUserAction, String aAnnotationValue)
{
  AnnotatorState state = ActiveLearningSidebar.this.getModelObject();
  ActiveLearningUserState alState = alStateModel.getObject();
  AnnotationFeature feat = annotationService.getFeature(aSuggestion.getFeature(),
      alState.getLayer());
  SourceDocument sourceDoc = documentService.getSourceDocument(state.getProject(),
      aSuggestion.getDocumentName());
  // Log the action to the learning record
  learningRecordService.logRecord(sourceDoc, state.getUser().getUsername(),
      aSuggestion, aAnnotationValue, alState.getLayer(), feat, aUserAction,
      LearningRecordChangeLocation.AL_SIDEBAR);
  // Send an application event that the suggestion has been rejected
  List<AnnotationSuggestion> alternativeSuggestions = recommendationService
      .getPredictions(state.getUser(), state.getProject())
      .getPredictionsByTokenAndFeature(aSuggestion.getDocumentName(), alState.getLayer(),
          aSuggestion.getBegin(), aSuggestion.getEnd(), aSuggestion.getFeature());
  applicationEventPublisherHolder.get()
      .publishEvent(new ActiveLearningRecommendationEvent(this, sourceDoc, aSuggestion,
          state.getUser().getUsername(), alState.getLayer(), aSuggestion.getFeature(),
          aUserAction, alternativeSuggestions));
}
origin: inception-project/inception

private void writeLearningRecordInDatabaseAndEventLog(AnnotationSuggestion aSuggestion,
    LearningRecordType aUserAction, String aAnnotationValue)
{
  AnnotatorState state = ActiveLearningSidebar.this.getModelObject();
  ActiveLearningUserState alState = alStateModel.getObject();
  AnnotationFeature feat = annotationService.getFeature(aSuggestion.getFeature(),
      alState.getLayer());
  SourceDocument sourceDoc = documentService.getSourceDocument(state.getProject(),
      aSuggestion.getDocumentName());
  // Log the action to the learning record
  learningRecordService.logRecord(sourceDoc, state.getUser().getUsername(),
      aSuggestion, aAnnotationValue, alState.getLayer(), feat, aUserAction,
      LearningRecordChangeLocation.AL_SIDEBAR);
  // Send an application event that the suggestion has been rejected
  List<AnnotationSuggestion> alternativeSuggestions = recommendationService
      .getPredictions(state.getUser(), state.getProject())
      .getPredictionsByTokenAndFeature(aSuggestion.getDocumentName(), alState.getLayer(),
          aSuggestion.getBegin(), aSuggestion.getEnd(), aSuggestion.getFeature());
  applicationEventPublisherHolder.get()
      .publishEvent(new ActiveLearningRecommendationEvent(this, sourceDoc, aSuggestion,
          state.getUser().getUsername(), alState.getLayer(), aSuggestion.getFeature(),
          aUserAction, alternativeSuggestions));
}
de.tudarmstadt.ukp.inception.recommendation.api.modelAnnotationSuggestiongetEnd

Popular methods of AnnotationSuggestion

  • getBegin
  • getConfidence
  • getFeature
  • getLabel
  • getLayerId
  • getRecommenderId
  • isVisible
  • getCoveredText
  • getDocumentName
  • getId
  • getOffset
  • getReasonForHiding
  • getOffset,
  • getReasonForHiding,
  • getRecommenderName,
  • getVID,
  • hide,
  • <init>,
  • equals,
  • getUiLabel,
  • show

Popular in Java

  • Parsing JSON documents to java classes using gson
  • addToBackStack (FragmentTransaction)
  • getSupportFragmentManager (FragmentActivity)
  • getApplicationContext (Context)
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now