Skip to content

Commit

Permalink
Merge branch 'main' into refactoring/4904-Upgrade-to-RDF4J-5.x
Browse files Browse the repository at this point in the history
* main: (114 commits)
  #5047 - Clean up layer detail UI a bit
  #4949 - Showing the start and end points of relations in left side bar
  No issue: Minor cleaning up
  #5043 - Ability to specify token breaking zones when calling tokenizer
  [maven-release-plugin] prepare for next development iteration
  [maven-release-plugin] prepare release inception-34.0-beta-6
  #5009 - Better handling of stacked annotations with link features in curation
  #5009 - Better handling of stacked annotations with link features in curation
  [maven-release-plugin] prepare for next development iteration
  [maven-release-plugin] prepare release inception-34.0-beta-6
  [maven-release-plugin] prepare for next development iteration
  [maven-release-plugin] prepare release inception-33.6
  #5040 - Improve feature form tab navigation
  #5037 - Show fraction of annotators that chose a certain label in curation sidebar mode
  #5035 - NBSPs should not be treated as tokens
  #5031 - ChatGPT recommender fails because format is not a supported parameter
  #5029 - Duplicate lines on the about page
  #5027 - Add more CSP configurations
  #4753 - Entity linker should skip already linked concepts
  #5007 - Lazy details on suggestions for multi-value concept features fail rendering
  ...

% Conflicts:
%	pom.xml
  • Loading branch information
reckart committed Sep 8, 2024
2 parents 784f125 + f08cb31 commit 0c6a273
Show file tree
Hide file tree
Showing 772 changed files with 107,802 additions and 15,975 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

# Make sure that these files are treated as binary so that newlines are preserved.
# overrides GIT's determination if a file is text or not
*.zip binary
*.gz binary
*.bin binary
*.dump binary
*.xcas binary
Expand Down
20 changes: 19 additions & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,38 @@ on:
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
jdk: [17]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref || github.ref }}

- name: Set up JDK ${{ matrix.jdk }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.jdk }}
distribution: 'temurin'
cache: maven

- name: Set up cache date
run: echo "CACHE_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV

- name: Cache Maven repository
id: maven-cache
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-${{ env.CACHE_DATE }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build with Maven
run: mvn --no-transfer-progress -B clean verify --file pom.xml

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ dependency-reduced-pom.xml
**/src/main/ts/package.json
**/src/main/ts/package-lock.json
local/
.asciidoctorconfig.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@
import java.util.Optional;

import org.apache.uima.cas.CAS;
import org.apache.uima.cas.Feature;
import org.apache.uima.cas.Type;
import org.apache.uima.cas.text.AnnotationFS;
import org.apache.uima.fit.util.CasUtil;
import org.apache.wicket.Component;
Expand Down Expand Up @@ -75,7 +73,7 @@
import de.tudarmstadt.ukp.clarin.webanno.model.ReorderableTag;
import de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument;
import de.tudarmstadt.ukp.clarin.webanno.security.UserDao;
import de.tudarmstadt.ukp.clarin.webanno.ui.annotation.AnnotationPage;
import de.tudarmstadt.ukp.clarin.webanno.ui.annotation.AnnotationPageBase2;
import de.tudarmstadt.ukp.clarin.webanno.ui.annotation.sidebar.AnnotationSidebar_ImplBase;
import de.tudarmstadt.ukp.inception.active.learning.ActiveLearningService;
import de.tudarmstadt.ukp.inception.active.learning.ActiveLearningServiceImpl;
Expand Down Expand Up @@ -182,7 +180,7 @@ public class ActiveLearningSidebar

private final WebMarkupContainer alMainContainer;

private AnnotationPage annotationPage;
private AnnotationPageBase2 annotationPage;
private BootstrapModalDialog dialog;
private FeatureEditor editor;
private Form<Void> recommendationForm;
Expand All @@ -199,11 +197,10 @@ enum FeatureDetailEditorUpdateFlag
KEEP_SELECTED_ANNOTATION_AND_VIEW, CLEAR_SELECTED_ANNOTATION_AND_JUMP_TO_SUGGESTION
}

public ActiveLearningSidebar(String aId, IModel<AnnotatorState> aModel,
AnnotationActionHandler aActionHandler, CasProvider aCasProvider,
AnnotationPage aAnnotationPage)
public ActiveLearningSidebar(String aId, AnnotationActionHandler aActionHandler,
CasProvider aCasProvider, AnnotationPageBase2 aAnnotationPage)
{
super(aId, aModel, aActionHandler, aCasProvider, aAnnotationPage);
super(aId, aActionHandler, aCasProvider, aAnnotationPage);

annotationPage = aAnnotationPage;

Expand Down Expand Up @@ -993,10 +990,11 @@ private void actionSelectHistoryItem(AjaxRequestTarget aTarget, LearningRecord a

private Optional<AnnotationFS> getMatchingAnnotation(CAS aCas, LearningRecord aRecord)
{
Type type = CasUtil.getType(aCas, alStateModel.getObject().getLayer().getName());
Feature feature = type.getFeatureByBaseName(aRecord.getAnnotationFeature().getName());
var type = CasUtil.getType(aCas, alStateModel.getObject().getLayer().getName());
var feature = type.getFeatureByBaseName(aRecord.getAnnotationFeature().getName());
return selectAt(aCas, type, aRecord.getOffsetBegin(), aRecord.getOffsetEnd()).stream()
.filter(fs -> aRecord.getAnnotation().equals(fs.getFeatureValueAsString(feature)))
.filter(fs -> Objects.equals(aRecord.getAnnotation(),
fs.getFeatureValueAsString(feature)))
.findFirst();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

import de.tudarmstadt.ukp.clarin.webanno.api.casstorage.CasProvider;
import de.tudarmstadt.ukp.clarin.webanno.model.Project;
import de.tudarmstadt.ukp.clarin.webanno.ui.annotation.AnnotationPage;
import de.tudarmstadt.ukp.clarin.webanno.ui.annotation.AnnotationPageBase2;
import de.tudarmstadt.ukp.clarin.webanno.ui.annotation.sidebar.AnnotationSidebarFactory_ImplBase;
import de.tudarmstadt.ukp.clarin.webanno.ui.annotation.sidebar.AnnotationSidebar_ImplBase;
import de.tudarmstadt.ukp.inception.active.learning.config.ActiveLearningAutoConfiguration;
Expand Down Expand Up @@ -80,11 +80,9 @@ public boolean applies(AnnotatorState aState)
}

@Override
public AnnotationSidebar_ImplBase create(String aId, IModel<AnnotatorState> aModel,
AnnotationActionHandler aActionHandler, CasProvider aCasProvider,
AnnotationPage aAnnotationPage)
public AnnotationSidebar_ImplBase create(String aId, AnnotationActionHandler aActionHandler,
CasProvider aCasProvider, AnnotationPageBase2 aAnnotationPage)
{
return new ActiveLearningSidebar(aId, aModel, aActionHandler, aCasProvider,
aAnnotationPage);
return new ActiveLearningSidebar(aId, aActionHandler, aCasProvider, aAnnotationPage);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,21 @@
*/
package de.tudarmstadt.ukp.inception.recommendation.api.model;

import static java.util.Arrays.fill;
import static org.assertj.core.api.Assertions.assertThat;

import java.util.Arrays;

import org.junit.jupiter.api.Test;

public class LearningRecordTest
{

@Test
public void thatTokenTextIsTruncated()
{
char[] charArray = new char[300];
Arrays.fill(charArray, 'X');
String longTokenText = new String(charArray);
var charArray = new char[300];
fill(charArray, 'X');
var longTokenText = new String(charArray);

LearningRecord sut = new LearningRecord();
var sut = new LearningRecord();
sut.setTokenText(longTokenText);

assertThat(sut.getTokenText()).as("TokenText has been truncated").hasSize(255);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@
import de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff;
import de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.Configuration;
import de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.ConfigurationSet;
import de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.LinkCompareBehavior;
import de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.Tag;
import de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.relation.RelationDiffAdapter;
import de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.relation.RelationPosition;
import de.tudarmstadt.ukp.inception.annotation.feature.link.LinkFeatureMultiplicityMode;

public class AgreementUtils
{
Expand Down Expand Up @@ -295,23 +295,33 @@ private static Object extractValueForAgreement(Configuration cfg, String user,
}

private static Object extractLinkFeatureValueForAgreement(FeatureStructure aFs, String aFeature,
int aLinkIndex, LinkCompareBehavior aLCB)
int aLinkIndex, LinkFeatureMultiplicityMode aLCB)
{
@SuppressWarnings("unchecked")
var links = (ArrayFS<FeatureStructure>) aFs
.getFeatureValue(aFs.getType().getFeatureByBaseName(aFeature));
var link = links.get(aLinkIndex);

switch (aLCB) {
case LINK_TARGET_AS_LABEL:
case ONE_TARGET_MULTIPLE_ROLES: {
// FIXME The target feature name should be obtained from the feature definition!
var target = (AnnotationFS) link
.getFeatureValue(link.getType().getFeatureByBaseName("target"));

return target.getBegin() + "-" + target.getEnd() + " [" + target.getCoveredText() + "]";
case LINK_ROLE_AS_LABEL:
}
case MULTIPLE_TARGETS_ONE_ROLE:
// FIXME The role feature name should be obtained from the feature definition!
return link.getStringValue(link.getType().getFeatureByBaseName("role"));
case MULTIPLE_TARGETS_MULTIPLE_ROLES: {
// FIXME The role feature name should be obtained from the feature definition!
// FIXME The target feature name should be obtained from the feature definition!
var target = (AnnotationFS) link
.getFeatureValue(link.getType().getFeatureByBaseName("target"));
return link.getStringValue(link.getType().getFeatureByBaseName("role")) + "@"
+ target.getBegin() + "-" + target.getEnd() + " [" + target.getCoveredText()
+ "]";
}
default:
throw new IllegalStateException("Unknown link target comparison mode [" + aLCB + "]");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,8 @@
*/
package de.tudarmstadt.ukp.clarin.webanno.agreement.measures;

import static de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.LinkCompareBehavior.LINK_TARGET_AS_LABEL;

import java.io.Serializable;

import de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.LinkCompareBehavior;

public class DefaultAgreementTraits
implements Serializable
{
Expand All @@ -31,18 +27,6 @@ public class DefaultAgreementTraits
private boolean limitToFinishedDocuments = false;
private boolean excludeIncomplete;

private LinkCompareBehavior linkCompareBehavior = LINK_TARGET_AS_LABEL;

public LinkCompareBehavior getLinkCompareBehavior()
{
return linkCompareBehavior;
}

public void setLinkCompareBehavior(LinkCompareBehavior aLinkCompareBehavior)
{
linkCompareBehavior = aLinkCompareBehavior;
}

public boolean isLimitToFinishedDocuments()
{
return limitToFinishedDocuments;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.IModel;

import de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.LinkCompareBehavior;
import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationFeature;
import de.tudarmstadt.ukp.clarin.webanno.model.LinkMode;
import de.tudarmstadt.ukp.inception.annotation.feature.link.LinkFeatureMultiplicityMode;

public class DefaultAgreementTraitsEditor<T extends DefaultAgreementTraits>
extends Panel
{
private static final long serialVersionUID = 7780019891761754494L;

private final DropDownChoice<LinkCompareBehavior> linkCompareBehaviorDropDown;
private final DropDownChoice<LinkFeatureMultiplicityMode> linkCompareBehaviorDropDown;

private final Form<T> form;

Expand All @@ -59,7 +59,7 @@ protected void onSubmit()
};

linkCompareBehaviorDropDown = new DropDownChoice<>("linkCompareBehavior",
asList(LinkCompareBehavior.values()), new EnumChoiceRenderer<>(this));
asList(LinkFeatureMultiplicityMode.values()), new EnumChoiceRenderer<>(this));
linkCompareBehaviorDropDown.add(
visibleWhen(aFeature.map(f -> LinkMode.NONE != f.getLinkMode()).orElse(false)));
linkCompareBehaviorDropDown.setOutputMarkupPlaceholderTag(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ linkCompareBehavior = Link treatment
LinkCompareBehavior.LINK_ROLE_AS_LABEL = Use link role as label
LinkCompareBehavior.LINK_TARGET_AS_LABEL = Use link target as label

excludeIncomplete = Exclude incomplete
excludeIncomplete = Only consider positions annotated by all annotators

limitToFinishedDocuments = Limit to finished documents
limitToFinishedDocuments = Only consider finished documents

Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,10 @@ public CohenKappaAgreementMeasure(AnnotationFeature aFeature, DefaultAgreementTr
public FullCodingAgreementResult getAgreement(Map<String, CAS> aCasMap)
{
var feature = getFeature();
var traits = getTraits();

var adapters = getDiffAdapters(annotationService, asList(feature.getLayer()));

var diff = doDiff(adapters, traits.getLinkCompareBehavior(), aCasMap);
var diff = doDiff(adapters, aCasMap);

var tagset = annotationService.listTags(feature.getTagset()).stream() //
.map(Tag::getName) //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,10 @@ public FleissKappaAgreementMeasure(AnnotationFeature aFeature, DefaultAgreementT
public FullCodingAgreementResult getAgreement(Map<String, CAS> aCasMap)
{
var feature = getFeature();
var traits = getTraits();

var adapters = getDiffAdapters(annotationService, asList(feature.getLayer()));

var diff = doDiff(adapters, traits.getLinkCompareBehavior(), aCasMap);
var diff = doDiff(adapters, aCasMap);

var tagset = annotationService.listTags(feature.getTagset()).stream() //
.map(Tag::getName) //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public FullCodingAgreementResult getAgreement(Map<String, CAS> aCasMap)

var adapters = getDiffAdapters(annotationService, asList(feature.getLayer()));

var diff = doDiff(adapters, traits.getLinkCompareBehavior(), aCasMap);
var diff = doDiff(adapters, aCasMap);

var tagset = annotationService.listTags(feature.getTagset()).stream() //
.map(Tag::getName) //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
package de.tudarmstadt.ukp.clarin.webanno.agreement.measures.krippendorffalphaunitizing;

import java.lang.invoke.MethodHandles;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;
Expand All @@ -27,6 +28,8 @@
import org.apache.uima.jcas.tcas.Annotation;
import org.dkpro.statistics.agreement.unitizing.KrippendorffAlphaUnitizingAgreement;
import org.dkpro.statistics.agreement.unitizing.UnitizingAnnotationStudy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import de.tudarmstadt.ukp.clarin.webanno.agreement.measures.AgreementMeasure_ImplBase;
import de.tudarmstadt.ukp.clarin.webanno.agreement.measures.DefaultAgreementTraits;
Expand All @@ -38,6 +41,8 @@ public class KrippendorffAlphaUnitizingAgreementMeasure
FullUnitizingAgreementResult, //
DefaultAgreementTraits>
{
private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

public KrippendorffAlphaUnitizingAgreementMeasure(AnnotationFeature aFeature,
DefaultAgreementTraits aTraits)
{
Expand Down Expand Up @@ -90,6 +95,9 @@ public FullUnitizingAgreementResult getAgreement(Map<String, CAS> aCasMap)
}
}

LOG.trace("Units in study : {}", study.getUnitCount());
LOG.trace("Raters im study: {}", study.getRaterCount());

var result = new FullUnitizingAgreementResult(typeName, getFeature().getName(), study,
new ArrayList<>(aCasMap.keySet()), getTraits().isExcludeIncomplete());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public class FullCodingAgreementResult

protected final DiffResult diff;
protected final List<ConfigurationSet> allSets;
protected final boolean excludeIncomplete;

public FullCodingAgreementResult(String aType, String aFeature, DiffResult aDiff,
ICodingAnnotationStudy aStudy, List<String> aCasGroupIds,
Expand All @@ -45,7 +44,6 @@ public FullCodingAgreementResult(String aType, String aFeature, DiffResult aDiff

allSets = aTaggedConfigurations;
diff = aDiff;
excludeIncomplete = aExcludeIncomplete;
}

public boolean noPositions()
Expand Down
Loading

0 comments on commit 0c6a273

Please sign in to comment.