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

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

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

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

public Delta(AnnotationSuggestion aFirst, AnnotationSuggestion aSecond)
{
  Validate.notNull(aFirst, "At least first item must be given to compute delta");
  first = aFirst;
  second = aSecond;
  if (second == null) {
    delta = Math.abs(aFirst.getConfidence());
  }
  else {
    delta = Math.abs(first.getConfidence() - second.getConfidence());
  }
}
origin: inception-project/inception

/**
 * 
 * @param aLayerId
 * @param aPredictions - list of sentences containing recommendations
 */
public void putPredictions(long aLayerId, List<AnnotationSuggestion> aPredictions)
{
  aPredictions.forEach(prediction -> {
    if (prediction.getLabel() != null) {
      predictions.put(new ExtendedId(user.getUsername(), project.getId(),
          prediction.getDocumentName(), aLayerId, prediction.getOffset(),
          prediction.getRecommenderId(), prediction.getId(), -1), prediction);
    }
  });
}
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 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: 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

if (!pref.isShowAllPredictions() && !ao.isVisible()) {
  continue;
if (!labelMap.containsKey(ao.getLabel())
    || !labelMap.get(ao.getLabel())
        .containsKey(ao.getRecommenderId())
    || labelMap.get(ao.getLabel()).get(ao.getRecommenderId())
        .getConfidence() < ao.getConfidence()) {
  if (labelMap.get(ao.getLabel()) == null) {
    confidencePerClassifier = new HashMap<>();
  } else {
    confidencePerClassifier = labelMap.get(ao.getLabel());
  confidencePerClassifier.put(ao.getRecommenderId(), ao);
  labelMap.put(ao.getLabel(), confidencePerClassifier);
for (Entry<Long, AnnotationSuggestion> classifier : labelMap.get(label)
    .entrySet()) {
  if (classifier.getValue().getConfidence() > maxConfidence) {
    maxConfidence = classifier.getValue().getConfidence();
    .filter(p -> p.getLabel().equals(label))
    .max(Comparator.comparingInt(AnnotationSuggestion::getId)).orElse(null);
VID vid = canonicalRecommendation.getVID();
      .getFeature(ao.getFeature(), layer);
origin: inception-project/inception

AnnotationSuggestion representative = get(0);
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]",
    representative.getDocumentName(), aSuggestion.getDocumentName());
Validate.isTrue(representative.getLayerId() == aSuggestion.getLayerId(),
    "All suggestions in a group must be on the same layer: expected [%d] but got [%d]",
    representative.getLayerId(), aSuggestion.getLayerId());
Validate.isTrue(representative.getFeature().equals(aSuggestion.getFeature()),
    "All suggestions in a group must be for the same feature: expected [%s] but got [%s]",
    representative.getFeature(), aSuggestion.getFeature());
offset = aSuggestion.getOffset();
feature = aSuggestion.getFeature();
layerId = aSuggestion.getLayerId();
documentName = aSuggestion.getDocumentName();
origin: de.tudarmstadt.ukp.inception.app/inception-active-learning

if (s.isVisible()) {
  records.stream()
      .filter(r -> r.getSourceDocument().getName().equals(s.getDocumentName())
          && r.getOffsetCharacterBegin() == s.getBegin()
          && r.getOffsetCharacterEnd() == s.getEnd()
          && r.getAnnotation().equals(s.getLabel()))
      .forEach(record -> {
        if (REJECTED.equals(record.getUserAction())) {
          s.hide(FLAG_REJECTED);
          s.hide(FLAG_SKIPPED);
origin: inception-project/inception

if (aSuggestion.getLabel() == null) {
  aSuggestion.hide(FLAG_NO_LABEL);
  return;
  if (record.getOffsetCharacterBegin() == aSuggestion.getBegin()
      && record.getOffsetCharacterEnd() == aSuggestion.getEnd()
      && record.getAnnotation().equals(aSuggestion.getLabel()))
      aSuggestion.hide(FLAG_REJECTED);
      break;
    case SKIPPED:
      aSuggestion.hide(FLAG_SKIPPED);
      break;
    default:
origin: inception-project/inception

public SuggestionGroup(AnnotationSuggestion... aItems)
{
  suggestions = new ArrayList<>(asList(aItems));
  sorted = suggestions.size() < 2;
  if (!suggestions.isEmpty()) {
    offset = suggestions.get(0).getOffset();
    feature = get(0).getFeature();
    layerId = get(0).getLayerId();
    documentName = get(0).getDocumentName();
  }
}
origin: inception-project/inception

    .setParameter("user", aUsername)
    .setParameter("sourceDocument", aDocument)
    .setParameter("offsetCharacterBegin", aSuggestion.getBegin())
    .setParameter("offsetCharacterEnd", aSuggestion.getEnd())
    .setParameter("layer", aLayer)
    .setParameter("annotationFeature", aFeature)
record.setSourceDocument(aDocument);
record.setUserAction(aUserAction);
record.setOffsetCharacterBegin(aSuggestion.getBegin());
record.setOffsetCharacterEnd(aSuggestion.getEnd());
record.setOffsetTokenBegin(-1);
record.setOffsetTokenEnd(-1);
record.setTokenText(aSuggestion.getCoveredText());
record.setAnnotation(aAlternativeLabel);
record.setLayer(aLayer);
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: de.tudarmstadt.ukp.inception.app/inception-active-learning

private static boolean isAlreadyInCleanList(SuggestionGroup cleanRecommendationList,
  AnnotationSuggestion recommendationItem)
{
  String source = recommendationItem.getRecommenderName();
  String annotation = recommendationItem.getLabel();
  String documentName = recommendationItem.getDocumentName();
  
  for (AnnotationSuggestion existingRecommendation : cleanRecommendationList) {
    if (
        existingRecommendation.getRecommenderName().equals(source) &&
        existingRecommendation.getLabel().equals(annotation) &&
        existingRecommendation.getDocumentName().equals(documentName)
    ) {
      return true;
    }
  }
  return false;
}
origin: inception-project/inception

/**
 * Returns the first prediction that matches recommendationId and recommenderId
 * in the given document.
 */
public Optional<AnnotationSuggestion> getPredictionByVID(SourceDocument aDocument, VID aVID)
{
  return predictions.values().stream()
      .filter(f -> f.getDocumentName().equals(aDocument.getName()))
      .filter(f -> f.getId() == aVID.getSubId())
      .filter(f -> f.getRecommenderId() == aVID.getId())
      .findFirst();
}
origin: inception-project/inception

private String formatLabel(AnnotationSuggestion aCurrentRecommendation)
{
  AnnotationFeature feat = annotationService.getFeature(aCurrentRecommendation.getFeature(),
      alStateModel.getObject().getLayer());
  FeatureSupport<?> featureSupport = featureSupportRegistry.getFeatureSupport(feat);
  String labelValue = featureSupport.renderFeatureValue(feat,
      aCurrentRecommendation.getLabel());
  return labelValue;
}
origin: inception-project/inception

suggestion.hide(FLAG_TRANSIENT_REJECTED);
        aBegin, aEnd, suggestion.getCoveredText(), feature, suggestion.getLabel()));
origin: inception-project/inception

if (top.isVisible()) {
  return singletonMap(top.getRecommenderId(), new Delta(top));
origin: inception-project/inception

  @Override
  public String toString()
  {
    return new ToStringBuilder(this).append("id", id).append("recommenderId", recommenderId)
        .append("recommenderName", recommenderName).append("layerId", layerId)
        .append("feature", feature).append("documentName", documentName)
        .append("begin", begin).append("end", end)
        .append("coveredText", coveredText).append("label", label)
        .append("uiLabel", uiLabel).append("confidence", confidence)
        .append("visible", isVisible())
        .append("reasonForHiding", getReasonForHiding()).toString();
  }
}
origin: inception-project/inception

private void writeLearningRecordInDatabaseAndEventLog(
    AnnotationSuggestion aCurrentRecommendation, LearningRecordType aUserAction)
{
  writeLearningRecordInDatabaseAndEventLog(aCurrentRecommendation, aUserAction,
      aCurrentRecommendation.getLabel());
}
de.tudarmstadt.ukp.inception.recommendation.api.modelAnnotationSuggestion

Most used methods

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

Popular in Java

  • Reading from database using SQL prepared statement
  • scheduleAtFixedRate (Timer)
  • getResourceAsStream (ClassLoader)
  • setContentView (Activity)
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • Table (org.hibernate.mapping)
    A relational table
  • Best IntelliJ 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