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

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

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

origin: inception-project/inception

private List<AnnotationSuggestion> getMatchingSuggestion(List<SuggestionGroup> aSuggestions,
    String aDocumentName, long aLayerId, String aFeature, int aBegin, int aEnd,
    String aLabel)
{
  return aSuggestions.stream()
      .filter(group -> 
          aDocumentName.equals(group.getDocumentName()) &&
          aLayerId == group.getLayerId() &&
          (aFeature == null || aFeature == group.getFeature()) &&
          (aBegin == -1 || aBegin == group.getOffset().getBegin()) &&
          (aEnd == -1 || aEnd == group.getOffset().getEnd()))
      .flatMap(group -> group.stream())
      .filter(suggestion ->
          aLabel == null || aLabel.equals(suggestion.getLabel()))
      .collect(toList());
}
origin: de.tudarmstadt.ukp.inception.app/inception-active-learning

private static SuggestionGroup removeDuplicateRecommendations(
    SuggestionGroup unmodifiedRecommendationList)
{
  SuggestionGroup cleanRecommendationList = new SuggestionGroup();
  unmodifiedRecommendationList.forEach(recommendationItem -> {
    if (!isAlreadyInCleanList(cleanRecommendationList, recommendationItem)) {
      cleanRecommendationList.add(recommendationItem);
    }
  });
  return cleanRecommendationList;
}
origin: inception-project/inception

public SuggestionDocumentGroup(List<AnnotationSuggestion> aSuggestions)
{
  this();
  SuggestionGroup.group(aSuggestions).stream().forEachOrdered(this::add);
}

origin: inception-project/inception

@Override
public BinaryOperator<SuggestionGroup> combiner()
{
  return (group1, group2) -> {
    group2.forEach(suggestion -> group1.add(suggestion));
    return group1;
  };
}
origin: inception-project/inception

if (isEmpty()) {
  return emptyMap();
else if (size() == 1) {
  AnnotationSuggestion top = get(0);
  return singletonMap(top.getRecommenderId(), asList(new Delta(top)));
  Map<Long, List<AnnotationSuggestion>> suggestionsByRecommenders = stream()
      .collect(groupingBy(AnnotationSuggestion::getRecommenderId));
origin: de.tudarmstadt.ukp.inception.app/inception-active-learning

private void actionClearSkippedRecommendations(AjaxRequestTarget aTarget, Form<Void> aForm)
  throws IOException
{
  learningRecordService.deleteSkippedSuggestions(getModelObject().getUser(),
      alStateModel.getObject().getLayer());
  ActiveLearningUserState alState = alStateModel.getObject();
  // The history records caused suggestions to disappear. Since visibility is only fully
  // recalculated when new predictions come in, we need to update the visibility explicitly
  // here
  alState.getSuggestions().stream()
    .flatMap(group -> group.stream())
    .forEach(suggestion -> suggestion.show(FLAG_SKIPPED));
  
  refreshSuggestions();
  moveToNextRecommendation(aTarget, false);
  
  aTarget.add(mainContainer);
}
origin: inception-project/inception

  .filter(group -> group.getLayerId() == aLayer.getId())
    Offset offset = group.getOffset();
    return aWindowBegin <= offset.getBegin() && offset.getEnd() <= aWindowEnd;
  })
    comparingInt(Offset::getBegin).thenComparingInt(Offset::getEnd));
suggestionsInWindow.stream()
    .filter(group -> group.getFeature().equals(feature.getName()))
    .forEach(group -> suggestions.put(group.getOffset(), group));
origin: inception-project/inception

@Override
public boolean add(SuggestionGroup aGroup)
{
  boolean empty = isEmpty();
  
  if (!empty) {
    Validate.isTrue(documentName.equals(aGroup.getDocumentName()),
        "All suggestions in a group must come from the same document: expected [%s] but got [%s]",
        documentName, aGroup.getDocumentName());
  }
  
  // Cache information that must be consistent in the group when the first item is added
  if (empty) {
    documentName = aGroup.getDocumentName();
  }
  
  return groups.add(aGroup);
}
origin: inception-project/inception

if (isEmpty()) {
  return emptyMap();
else if (size() == 1) {
  AnnotationSuggestion top = get(0);
  if (top.isVisible()) {
    return singletonMap(top.getRecommenderId(), new Delta(top));
  Map<Long, List<AnnotationSuggestion>> predictionsByRecommenders = stream()
      .collect(groupingBy(AnnotationSuggestion::getRecommenderId));
origin: inception-project/inception

private void actionClearSkippedRecommendations(AjaxRequestTarget aTarget, Form<Void> aForm)
  throws IOException
{
  learningRecordService.deleteSkippedSuggestions(getModelObject().getUser(),
      alStateModel.getObject().getLayer());
  ActiveLearningUserState alState = alStateModel.getObject();
  // The history records caused suggestions to disappear. Since visibility is only fully
  // recalculated when new predictions come in, we need to update the visibility explicitly
  // here
  alState.getSuggestions().stream()
    .flatMap(group -> group.stream())
    .forEach(suggestion -> suggestion.show(FLAG_SKIPPED));
  
  refreshSuggestions();
  moveToNextRecommendation(aTarget, false);
  
  aTarget.add(mainContainer);
}
origin: de.tudarmstadt.ukp.inception.app/inception-active-learning

private List<AnnotationSuggestion> getMatchingSuggestion(List<SuggestionGroup> aSuggestions,
    String aDocumentName, long aLayerId, String aFeature, int aBegin, int aEnd,
    String aLabel)
{
  return aSuggestions.stream()
      .filter(group -> 
          aDocumentName.equals(group.getDocumentName()) &&
          aLayerId == group.getLayerId() &&
          (aFeature == null || aFeature == group.getFeature()) &&
          (aBegin == -1 || aBegin == group.getOffset().getBegin()) &&
          (aEnd == -1 || aEnd == group.getOffset().getEnd()))
      .flatMap(group -> group.stream())
      .filter(suggestion ->
          aLabel == null || aLabel.equals(suggestion.getLabel()))
      .collect(toList());
}
origin: inception-project/inception

private static SuggestionGroup removeDuplicateRecommendations(
    SuggestionGroup unmodifiedRecommendationList)
{
  SuggestionGroup cleanRecommendationList = new SuggestionGroup();
  unmodifiedRecommendationList.forEach(recommendationItem -> {
    if (!isAlreadyInCleanList(cleanRecommendationList, recommendationItem)) {
      cleanRecommendationList.add(recommendationItem);
    }
  });
  return cleanRecommendationList;
}
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

Collection<SuggestionGroup> groups = SuggestionGroup.group(predictions);
calculateVisibility(learningRecordService, annoService, jCas.get(),
    getUser().getUsername(), layer, groups, 0,
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: inception-project/inception

AnnotationSuggestion canonicalRecommendation = suggestion.stream()
    .filter(p -> p.getLabel().equals(label))
    .max(Comparator.comparingInt(AnnotationSuggestion::getId)).orElse(null);
de.tudarmstadt.ukp.inception.recommendation.api.modelSuggestionGroup

Javadoc

Group of alternative suggestions generated by one or more recommenders. The group maintains an order of the alternative suggestions, by default using the confidence score.

Most used methods

  • stream
  • add
  • forEach
  • getDocumentName
  • getFeature
  • getLayerId
  • getOffset
  • group
  • <init>
  • collector
  • ensureSortedState
  • get
  • ensureSortedState,
  • get,
  • getTopDeltas,
  • isEmpty,
  • size

Popular in Java

  • Reading from database using SQL prepared statement
  • putExtra (Intent)
  • compareTo (BigDecimal)
  • getExternalFilesDir (Context)
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • JPanel (javax.swing)
  • Top 15 Vim Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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