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

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

Best Java code snippets using de.tudarmstadt.ukp.inception.recommendation.api.model.AnnotationSuggestion.getDocumentName (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: 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: 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

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: 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

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

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

/**
 * 
 * @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

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

    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]",
feature = aSuggestion.getFeature();
layerId = aSuggestion.getLayerId();
documentName = aSuggestion.getDocumentName();
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 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()
origin: inception-project/inception

.filter(r -> r.getSourceDocument().getName().equals(s.getDocumentName())
    && r.getOffsetCharacterBegin() == s.getBegin()
    && r.getOffsetCharacterEnd() == s.getEnd()
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));
}
origin: de.tudarmstadt.ukp.inception.app/inception-active-learning

eventState.getSelectedAnnotationLayer(), rejectedRecommendation.getFeature(),
REJECTED, model.getPredictionsByTokenAndFeature(
rejectedRecommendation.getDocumentName(),
eventState.getSelectedAnnotationLayer(),
rejectedRecommendation.getBegin(),
de.tudarmstadt.ukp.inception.recommendation.api.modelAnnotationSuggestiongetDocumentName

Popular methods of AnnotationSuggestion

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

Popular in Java

  • Parsing JSON documents to java classes using gson
  • runOnUiThread (Activity)
  • addToBackStack (FragmentTransaction)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • From CI to AI: The AI layer in your organization
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