congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
AnnotationSuggestion.getFeature
Code IndexAdd Tabnine to your IDE (free)

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

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

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

  /**
   * TODO #176 use the document Id once it it available in the CAS
   * Returns a list of predictions for a given token that matches the given layer and
   * the annotation feature in the given document
   *
   * @param aDocumentName the given document name
   * @param aLayer the given layer
   * @param aBegin the offset character begin
   * @param aEnd the offset character end
   * @param aFeature the given annotation feature name
   * @return
   */
  public List<AnnotationSuggestion> getPredictionsByTokenAndFeature(String aDocumentName,
    AnnotationLayer aLayer, int aBegin, int aEnd, String aFeature)
  {
    return predictions.entrySet().stream()
      .filter(f -> f.getKey().getDocumentName().equals(aDocumentName))
      .filter(f -> f.getKey().getLayerId() == aLayer.getId())
      .filter(f -> f.getKey().getOffset().getBeginCharacter() == aBegin)
      .filter(f -> f.getKey().getOffset().getEndCharacter() == aEnd)
      .filter(f -> f.getValue().getFeature().equals(aFeature))
      .map(Map.Entry::getValue)
      .collect(Collectors.toList());

  }
}
origin: inception-project/inception

public GroupKey(AnnotationSuggestion aSuggestion)
{
  super();
  begin = aSuggestion.getBegin();
  end = aSuggestion.getEnd();
  feature = aSuggestion.getFeature();
  layerId = aSuggestion.getLayerId();
}
origin: inception-project/inception

    "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());
feature = aSuggestion.getFeature();
layerId = aSuggestion.getLayerId();
documentName = aSuggestion.getDocumentName();
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 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: de.tudarmstadt.ukp.inception.app/inception-active-learning

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

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

AnnotationFeature feat = annotationService.getFeature(aCurrentRecommendation.getFeature(),
    alState.getLayer());
FeatureSupport<?> featureSupport = featureSupportRegistry.getFeatureSupport(feat);
      aCurrentRecommendation.getDocumentName(), alState.getLayer(),
      aCurrentRecommendation.getBegin(), aCurrentRecommendation.getEnd(),
      aCurrentRecommendation.getFeature());
origin: inception-project/inception

AnnotationFeature feat = annotationService.getFeature(aCurrentRecommendation.getFeature(),
    alState.getLayer());
FeatureSupport<?> featureSupport = featureSupportRegistry.getFeatureSupport(feat);
      aCurrentRecommendation.getDocumentName(), alState.getLayer(),
      aCurrentRecommendation.getBegin(), aCurrentRecommendation.getEnd(),
      aCurrentRecommendation.getFeature());
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

/**
 * Listens to the user setting a feature on an annotation in the main annotation editor. Mind
 * that we do not need to listen to the creation of annotations since they have no effect on 
 * the active learning sidebar as long as they have no features set.
 */
@OnEvent
public void onFeatureValueUpdated(FeatureValueUpdatedEvent aEvent)
{
  AnnotatorState state = getModelObject();
  ActiveLearningUserState alState = alStateModel.getObject();
  // If the user creates a new annotation at the site of the suggestion that is currently
  // offered to the user, then the AL should move on to the next available suggestion
  if (
      alState.isSessionActive() &&
      (!alState.getSuggestion().isPresent() || (
      aEvent.getUser().equals(state.getUser().getUsername()) &&
      aEvent.getDocument().equals(state.getDocument()) &&
      aEvent.getFeature().getLayer().equals(alState.getLayer()) &&
      aEvent.getFeature().getName().equals(alState.getSuggestion().get().getFeature())))
  ) {
    reactToAnnotationsBeingCreatedOrDeleted(aEvent.getRequestTarget(),
        aEvent.getFeature().getLayer());
  }
}

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

new ActiveLearningRecommendationEvent(this, eventState.getDocument(),
  acceptedSuggestion, state.getUser().getUsername(),
  eventState.getSelectedAnnotationLayer(), acceptedSuggestion.getFeature(),
  ACCEPTED, model.getPredictionsByTokenAndFeature(
  acceptedSuggestion.getDocumentName(),
  acceptedSuggestion.getBegin(),
  acceptedSuggestion.getEnd(),
  acceptedSuggestion.getFeature())));
    acceptedSuggestion.getOffset().equals(suggestion.getOffset()) && 
    vid.getLayerId() == suggestion.getLayerId() && 
    acceptedSuggestion.getFeature().equals(suggestion.getFeature())
) {
  moveToNextRecommendation(aEvent.getTarget(), false);
origin: inception-project/inception

/**
 * Listens to the user setting a feature on an annotation in the main annotation editor. Mind
 * that we do not need to listen to the creation of annotations since they have no effect on 
 * the active learning sidebar as long as they have no features set.
 */
@OnEvent
public void onFeatureValueUpdated(FeatureValueUpdatedEvent aEvent)
{
  AnnotatorState state = getModelObject();
  ActiveLearningUserState alState = alStateModel.getObject();
  // If the user creates a new annotation at the site of the suggestion that is currently
  // offered to the user, then the AL should move on to the next available suggestion
  if (
      alState.isSessionActive() &&
      (!alState.getSuggestion().isPresent() || (
      aEvent.getUser().equals(state.getUser().getUsername()) &&
      aEvent.getDocument().equals(state.getDocument()) &&
      aEvent.getFeature().getLayer().equals(alState.getLayer()) &&
      aEvent.getFeature().getName().equals(alState.getSuggestion().get().getFeature())))
  ) {
    reactToAnnotationsBeingCreatedOrDeleted(aEvent.getRequestTarget(),
        aEvent.getFeature().getLayer());
  }
}

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

new ActiveLearningRecommendationEvent(this, eventState.getDocument(),
  rejectedRecommendation, annotatorState.getUser().getUsername(),
  eventState.getSelectedAnnotationLayer(), rejectedRecommendation.getFeature(),
  REJECTED, model.getPredictionsByTokenAndFeature(
  rejectedRecommendation.getDocumentName(),
  rejectedRecommendation.getBegin(),
  rejectedRecommendation.getEnd(),
  rejectedRecommendation.getFeature())));
origin: inception-project/inception

new ActiveLearningRecommendationEvent(this, eventState.getDocument(),
  rejectedRecommendation, annotatorState.getUser().getUsername(),
  eventState.getSelectedAnnotationLayer(), rejectedRecommendation.getFeature(),
  REJECTED, model.getPredictionsByTokenAndFeature(
  rejectedRecommendation.getDocumentName(),
  rejectedRecommendation.getBegin(),
  rejectedRecommendation.getEnd(),
  rejectedRecommendation.getFeature())));
origin: inception-project/inception

AnnotationFeature feature = annotationService.getFeature(suggestion.getFeature(), layer);
int address = recommendationService.upsertFeature(annotationService, aState.getDocument(),
    aState.getUser().getUsername(), aJCas, layer, feature, suggestion.getLabel(),
de.tudarmstadt.ukp.inception.recommendation.api.modelAnnotationSuggestiongetFeature

Popular methods of AnnotationSuggestion

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

Popular in Java

  • Reading from database using SQL prepared statement
  • setContentView (Activity)
  • onCreateOptionsMenu (Activity)
  • setScale (BigDecimal)
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • JButton (javax.swing)
  • Table (org.hibernate.mapping)
    A relational table
  • Sublime Text for Python
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