Codota Logo
AnnotationSuggestion.getEnd
Code IndexAdd Codota 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)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
SimpleDateFormat s =
  • Codota IconString pattern;new SimpleDateFormat(pattern)
  • Codota IconString template;Locale locale;new SimpleDateFormat(template, locale)
  • Codota Iconnew SimpleDateFormat()
  • Smart code suggestions by Codota
}
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

  • Running tasks concurrently on multiple threads
  • setRequestProperty (URLConnection)
  • startActivity (Activity)
  • runOnUiThread (Activity)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • ArrayList (java.util)
    Resizable-array implementation of the List interface. Implements all optional list operations, and p
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now