Skip to content

Commit

Permalink
Merge branch 'main' into bug/2824-Layer-name-with-special-characters-…
Browse files Browse the repository at this point in the history
…causes-problems-in-search

* main: (106 commits)
  No issue: Cancel running builds when a new one on the same branch is triggered
  No issue: Try deploying Maven artifacts
  No issue: Try deploying Maven artifacts
  No issue: Try deploying Maven artifacts
  No issue: Try deploying Maven artifacts
  #5203 - Disable export of data for annotators by default
  #5201 - Users should be able to change their own password by default
  [maven-release-plugin] prepare for next development iteration
  [maven-release-plugin] prepare release inception-35.0-beta-2
  Issue #5078: Upgrade dependencies
  Issue #5078: Upgrade dependencies
  Issue #5159: Improve HTML render performance
  [maven-release-plugin] prepare for next development iteration
  [maven-release-plugin] prepare release inception-34.5
  Issue #5078: Upgrade dependencies
  Issue #5078: Upgrade dependencies
  Issue #5078: Upgrade dependencies
  Issue #5078: Upgrade dependencies
  #5196  - Improve display of plain text files in HTML editor
  #5194 - Preferences when opening document in HTML editor
  ...

% Conflicts:
%	inception/inception-pdf-editor/pom.xml
%	inception/inception-ui-project/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/project/layers/ProjectLayersPanel.html
  • Loading branch information
reckart committed Dec 20, 2024
2 parents 5b2931e + 9d81dde commit eb546eb
Show file tree
Hide file tree
Showing 586 changed files with 10,034 additions and 6,239 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@
*.ser binary
*.png binary
*.jpg binary
*.pptx binary
*.svg binary
41 changes: 28 additions & 13 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Java CI with Maven

on:
Expand All @@ -14,6 +6,10 @@ on:
pull_request:
branches: [ "main", "release/**" ]

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

jobs:
build:
strategy:
Expand All @@ -36,6 +32,14 @@ jobs:
java-version: ${{ matrix.jdk }}
distribution: 'temurin'
cache: maven
server-id: ukp-oss-snapshots
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD

- name: Set up Maven
uses: stCarolas/setup-maven@v5
with:
maven-version: 3.9.9

- name: Set up cache date
run: echo "CACHE_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
Expand All @@ -50,9 +54,20 @@ jobs:
${{ runner.os }}-maven-
- name: Build with Maven
run: mvn --no-transfer-progress -B clean verify --file pom.xml
if: "!(matrix.os == 'ubuntu-latest' && github.event_name != 'pull_request')"
run: mvn --show-version --batch-mode --no-transfer-progress clean verify

- name: Build with Maven and publish artifacts
if: matrix.os == 'ubuntu-latest' && github.event_name != 'pull_request'
env:
# `MAVEN_USERNAME` and `MAVEN_PASSWORD` are used in `~/.m2/settings.xml` created by `setup-java` action
MAVEN_USERNAME: ${{ secrets.UKP_MAVEN_USER }}
MAVEN_PASSWORD: ${{ secrets.UKP_MAVEN_TOKEN }}
run: mvn --show-version --batch-mode --errors --no-transfer-progress -DdeployAtEnd=true -DskipTests clean deploy

# Fails with error message - no idea why...
# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
# - name: Update dependency graph
# uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6
- name: Capture build artifacts
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: inception/inception-app-webapp/target/inception-app-webapp-*-standalone.jar
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Active learning is a family of methods which seeks to optimize the learning rate

Open the Active Learning sidebar on the left of the screen. You can choose from a list of all layers for which recommenders have been configured and then start an active learning session on that layer.

image::activeLearning2.png[select, 350, 350, align="center"]
image::images/activeLearning2.png[select, 350, 350, align="center"]

The system will start showing recommendations, one by one, according to the
<<developer-guide.adoc#sect_activeLearning_uncertaintySampling,uncertainty sampling>> learning strategy. For every recommendation, it shows the related text, the
Expand All @@ -14,7 +14,7 @@ given score and the closest score calculated for another suggestion made by the

One can now _Annotate_, _Reject_ or _Skip_ this recommendation in the Active Learning sidebar:

image::activeLearning3.png[align="center"]
image::images/activeLearning3.png[align="center"]

When using the _Annotate_, _Reject_ or _Skip_ buttons, the system automatically jumps to the next suggestion for the user to inspect. However, at times it may be necessary to go back to a recently inspected suggestion in order to review it. The *History* panel shows the 50 most recent actions. Clicking on the text of an item loads it in the main annotation editor. It is also possible to delete items from the history, e.g. wrongly rejected items.

Expand Down
5 changes: 0 additions & 5 deletions inception/inception-agreement/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,6 @@
<artifactId>inception-io-webanno-tsv</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-schema</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.dkpro.core</groupId>
<artifactId>dkpro-core-api-lexmorph-asl</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.DoubleStream;

Expand Down Expand Up @@ -61,7 +62,7 @@ public void merge(AgreementSummary aResult)
+ "] but encountered [" + aResult.type + "]");
}

if (!feature.equals(aResult.feature)) {
if (!Objects.equals(feature, aResult.feature)) {
throw new IllegalArgumentException("All merged results must have the same feature ["
+ feature + "] but encountered [" + aResult.feature + "]");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import org.dkpro.statistics.agreement.coding.CodingAnnotationStudy;
import org.dkpro.statistics.agreement.coding.ICodingAnnotationStudy;

import de.tudarmstadt.ukp.clarin.webanno.agreement.measures.AgreementMeasure;
import de.tudarmstadt.ukp.clarin.webanno.agreement.results.coding.FullCodingAgreementResult;
import de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff;
import de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.Configuration;
Expand Down Expand Up @@ -106,7 +107,8 @@ private static FullCodingAgreementResult makeCodingStudy(CasDiff aDiff,

// This happens in our test cases when we feed the process with uninitialized CASes.
// We should just do the right thing here which is: do nothing
if (ts.getType(aType) == null) {
var type = ts.getType(aType);
if (type == null) {
// All positions are irrelevant
var irrelevantSets = aDiff.getPositions().stream() //
.map(aDiff::getConfigurationSet) //
Expand All @@ -118,13 +120,14 @@ private static FullCodingAgreementResult makeCodingStudy(CasDiff aDiff,
}

// Check that the feature really exists instead of just getting a NPE later
if (ts.getType(aType).getFeatureByBaseName(aFeature) == null) {
if (aFeature != null && type.getFeatureByBaseName(aFeature) == null) {
throw new IllegalArgumentException(
"Type [" + aType + "] has no feature called [" + aFeature + "]");
}

var isPrimitiveFeature = ts.getType(aType).getFeatureByBaseName(aFeature).getRange()
.isPrimitive();
var isPrimitiveFeature = aFeature != null
? type.getFeatureByBaseName(aFeature).getRange().isPrimitive()
: true;

nextPosition: for (var p : aDiff.getPositions()) {
var cfgSet = aDiff.getConfigurationSet(p);
Expand All @@ -136,7 +139,7 @@ private static FullCodingAgreementResult makeCodingStudy(CasDiff aDiff,
}

// If the feature on a position is set, then it is a subposition
var isSubPosition = p.getFeature() != null;
var isSubPosition = p.getLinkFeature() != null;

// Check if this position is irrelevant:
// - if we are looking for a primitive type and encounter a subposition
Expand All @@ -149,7 +152,8 @@ private static FullCodingAgreementResult makeCodingStudy(CasDiff aDiff,

// Check if subposition is for the feature we are looking for or for a different
// feature
if (isSubPosition && !aFeature.equals(cfgSet.getPosition().getFeature())) {
if (isSubPosition && (aFeature == null
|| !aFeature.equals(cfgSet.getPosition().getLinkFeature()))) {
cfgSet.addTags(Tag.IRRELEVANT);
continue nextPosition;
}
Expand Down Expand Up @@ -203,7 +207,7 @@ private static FullCodingAgreementResult makeCodingStudy(CasDiff aDiff,
if (cfg.getPosition() instanceof RelationPosition pos) {
var arc = cfg.getFs(user, aCasMap);

var adapter = (RelationDiffAdapter) aDiff.getTypeAdapters().get(pos.getType());
var adapter = (RelationDiffAdapter) aDiff.getAdapters().get(pos.getType());

// Check if the source of the relation is stacked
var source = getFeature(arc, adapter.getSourceFeature(), AnnotationFS.class);
Expand Down Expand Up @@ -238,8 +242,8 @@ private static FullCodingAgreementResult makeCodingStudy(CasDiff aDiff,

// If the position feature is set (subposition), then it must match the feature we
// are calculating agreement over
assert cfgSet.getPosition().getFeature() == null
|| cfgSet.getPosition().getFeature().equals(aFeature);
assert cfgSet.getPosition().getLinkFeature() == null
|| cfgSet.getPosition().getLinkFeature().equals(aFeature);

if (!containsAny(cfgSet.getTags(), INCOMPLETE_LABEL, INCOMPLETE_POSITION)) {
cfgSet.addTags(COMPLETE);
Expand All @@ -262,17 +266,20 @@ private static FullCodingAgreementResult makeCodingStudy(CasDiff aDiff,
private static Object extractValueForAgreement(Configuration cfg, String user,
Map<String, CAS> aCasMap, String aFeature)
{
if (aFeature == null) {
return AgreementMeasure.POSITION;
}

var fs = cfg.getFs(user, aCasMap);
var linkIndex = cfg.getAID(user).index;
var isPrimitiveFeature = fs.getType().getFeatureByBaseName(aFeature).getRange()
.isPrimitive();
var type = fs.getType();
var isPrimitiveFeature = type.getFeatureByBaseName(aFeature).getRange().isPrimitive();

// If the feature on a position is set, then it is a subposition
var isSubPosition = linkIndex != -1;

// BEGIN PARANOIA
assert fs.getType().getFeatureByBaseName(aFeature).getRange()
.isPrimitive() == isPrimitiveFeature;
assert type.getFeatureByBaseName(aFeature).getRange().isPrimitive() == isPrimitiveFeature;
// primitive implies not subposition - if this is primitive and subposition, we
// should never have gotten here in the first place.
assert !isPrimitiveFeature || !isSubPosition;
Expand All @@ -286,12 +293,12 @@ private static Object extractValueForAgreement(Configuration cfg, String user,
if (!isPrimitiveFeature && isSubPosition) {
// Link feature / sub-position
return extractLinkFeatureValueForAgreement(fs, aFeature, linkIndex,
cfg.getPosition().getLinkCompareBehavior());
cfg.getPosition().getLinkFeatureMultiplicityMode());
}

throw new IllegalStateException("Should never get here: primitive: "
+ fs.getType().getFeatureByBaseName(aFeature).getRange().isPrimitive()
+ "; subpos: " + isSubPosition);
+ type.getFeatureByBaseName(aFeature).getRange().isPrimitive() + "; subpos: "
+ isSubPosition);
}

private static Object extractLinkFeatureValueForAgreement(FeatureStructure aFs, String aFeature,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,16 @@
import org.apache.uima.cas.CAS;

import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationFeature;
import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationLayer;

public interface AgreementMeasure<R extends Serializable>
{
static final String POSITION = "<POS>";

R getAgreement(Map<String, CAS> aCasMap);

AnnotationLayer getLayer();

AnnotationFeature getFeature();

DefaultAgreementTraits getTraits();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import de.tudarmstadt.ukp.clarin.webanno.agreement.AgreementResult_ImplBase;
import de.tudarmstadt.ukp.clarin.webanno.agreement.FullAgreementResult_ImplBase;
import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationFeature;
import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationLayer;

public interface AgreementMeasureSupport<//
T extends DefaultAgreementTraits, //
Expand All @@ -42,7 +43,7 @@ public interface AgreementMeasureSupport<//
* a feature definition.
* @return whether the given feature is supported by the current agreement measure support.
*/
boolean accepts(AnnotationFeature aFeature);
boolean accepts(AnnotationLayer aLayer, AnnotationFeature aFeature);

/**
* Returns a Wicket component to configure the specific traits of this measure.
Expand All @@ -55,13 +56,25 @@ public interface AgreementMeasureSupport<//
* a model holding the measure settings.
* @return the traits editor component .
*/
default Panel createTraitsEditor(String aId, IModel<AnnotationLayer> aLayer,
IModel<AnnotationFeature> aFeature, IModel<T> aModel)
{
return new EmptyPanel(aId);
}

default Panel createTraitsEditor(String aId, IModel<AnnotationFeature> aFeature,
IModel<T> aModel)
{
return new EmptyPanel(aId);
return createTraitsEditor(aId, aFeature.map(AnnotationFeature::getLayer), aFeature, aModel);
}

default AgreementMeasure<R> createMeasure(AnnotationFeature aFeature, T aTraits)
{
return createMeasure(aFeature.getLayer(), aFeature, aTraits);
}

AgreementMeasure<R> createMeasure(AnnotationFeature aFeature, T aTraits);
AgreementMeasure<R> createMeasure(AnnotationLayer aLayer, AnnotationFeature aFeature,
T aTraits);

T createTraits();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.List;

import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationFeature;
import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationLayer;

public interface AgreementMeasureSupportRegistry
{
Expand All @@ -28,9 +29,9 @@ public interface AgreementMeasureSupportRegistry

AgreementMeasureSupport<?, ?, ?> getAgreementMeasureSupport(String aId);

List<AgreementMeasureSupport<?, ?, ?>> getAgreementMeasureSupports(AnnotationFeature aFeature);

AgreementMeasure<?> getMeasure(AnnotationFeature aFeature, String aMeasure,
DefaultAgreementTraits aTraits);
List<AgreementMeasureSupport<?, ?, ?>> getAgreementMeasureSupports(AnnotationLayer aLayer,
AnnotationFeature aFeature);

AgreementMeasure<?> getMeasure(AnnotationLayer aLayer, AnnotationFeature aFeature,
String aMeasure, DefaultAgreementTraits aTraits);
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.springframework.stereotype.Component;

import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationFeature;
import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationLayer;
import de.tudarmstadt.ukp.inception.support.logging.BaseLoggers;

@Component
Expand Down Expand Up @@ -95,21 +96,20 @@ public AgreementMeasureSupport getAgreementMeasureSupport(String aId)

@Override
public List<AgreementMeasureSupport<?, ?, ?>> getAgreementMeasureSupports(
AnnotationFeature aFeature)
AnnotationLayer aLayer, AnnotationFeature aFeature)
{
return agreementMeasures.stream() //
.filter(factory -> factory.accepts(aFeature)) //
.filter(factory -> factory.accepts(aLayer, aFeature)) //
.sorted(comparing(AgreementMeasureSupport::getName)) //
.collect(toList());
}

@Override
public AgreementMeasure getMeasure(AnnotationFeature aFeature, String aMeasure,
DefaultAgreementTraits traits)
public AgreementMeasure getMeasure(AnnotationLayer aLayer, AnnotationFeature aFeature,
String aMeasure, DefaultAgreementTraits traits)
{
AgreementMeasureSupport ams = getAgreementMeasureSupport(aMeasure);

var measure = ams.createMeasure(aFeature, traits);
var ams = getAgreementMeasureSupport(aMeasure);
var measure = ams.createMeasure(aLayer, aFeature, traits);
return measure;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import de.tudarmstadt.ukp.clarin.webanno.agreement.FullAgreementResult_ImplBase;
import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationFeature;
import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationLayer;

public abstract class AgreementMeasureSupport_ImplBase<//
T extends DefaultAgreementTraits, //
Expand All @@ -32,8 +33,8 @@ public abstract class AgreementMeasureSupport_ImplBase<//
{
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public Panel createTraitsEditor(String aId, IModel<AnnotationFeature> aFeature,
IModel<T> aModel)
public Panel createTraitsEditor(String aId, IModel<AnnotationLayer> aLayer,
IModel<AnnotationFeature> aFeature, IModel<T> aModel)
{
return new DefaultAgreementTraitsEditor<DefaultAgreementTraits>(aId, aFeature,
(IModel) aModel);
Expand Down
Loading

0 comments on commit eb546eb

Please sign in to comment.