Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
208 changes: 26 additions & 182 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>io.github.ardoco</groupId>
<parent>
<groupId>io.github.ardoco</groupId>
<artifactId>parent</artifactId>
<version>2.0.0-SNAPSHOT</version>
</parent>

<artifactId>named-architecture-entity-recognition</artifactId>
<version>1.0.0-SNAPSHOT</version>

Expand All @@ -28,7 +33,6 @@
<timezone>GMT+1</timezone>
</developer>
</developers>

<scm>
<connection>scm:git:git://github.com/ArDoCo/NamedArchitectureEntityRecognition.git</connection>
<developerConnection>scm:git:ssh://github.com:ArDoCo/NamedArchitectureEntityRecognition.git</developerConnection>
Expand All @@ -50,16 +54,6 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<project.source.encoding>UTF-8</project.source.encoding>
<java.version>21</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<maven.compiler.release>${java.version}</maven.compiler.release>

<ardoco.version>1.1.0</ardoco.version>
<slf4j.version>2.0.14</slf4j.version>
<spotless.version>2.43.0</spotless.version>
<junit.version>5.11.0</junit.version>
<jackson.version>2.17.2</jackson.version>
</properties>

<dependencyManagement>
Expand All @@ -75,11 +69,9 @@
</dependencyManagement>

<dependencies>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>dev.langchain4j</groupId>
Expand All @@ -89,204 +81,57 @@
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-open-ai</artifactId>
</dependency>

<dependency>
<groupId>io.github.ardoco</groupId>
<artifactId>metrics</artifactId>
<version>0.1.1</version>
<version>${metrics.version}</version>
</dependency>

<dependency>
<groupId>io.github.ardoco.core</groupId>
<artifactId>common</artifactId>
<version>${ardoco.version}</version>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.13.1</version>
</dependency>

<dependency>
<groupId>io.github.cdimascio</groupId>
<artifactId>dotenv-java</artifactId>
<version>3.2.0</version>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4j.version}</version>
<scope>test</scope>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.13.1</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>mavenCentral</id>
<url>https://repo1.maven.org/maven2/</url>
</repository>
<repository>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>mavenSnapshot</id>
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
</repository>
</repositories>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<release>${java.version}</release>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>UTF-8</encoding>
<fork>true</fork>
<meminitial>128m</meminitial>
<maxmem>512m</maxmem>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.2.5</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<phase>integration-test</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.2.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>3.1.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.4.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
</plugin>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.7.0</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
<autoPublish>true</autoPublish>
<waitUntil>published</waitUntil>
<deploymentName>ardoco-naer</deploymentName>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>${spotless.version}</version>
<configuration>
<formats>
<format>
<includes>
<include>*.md</include>
<include>.gitignore</include>
</includes>
<trimTrailingWhitespace />
<endWithNewline />
<indent>
<tabs>true</tabs>
<spacesPerTab>4</spacesPerTab>
</indent>
</format>
</formats>
<!-- define a language-specific format -->
<java>
<eclipse>
<!--suppress UnresolvedMavenProperty -->
<file>${maven.multiModuleProjectDirectory}/formatter.xml</file>
</eclipse>
<removeUnusedImports />
<licenseHeader>
<!--suppress UnresolvedMavenProperty -->
<file>${maven.multiModuleProjectDirectory}/license-header</file>
</licenseHeader>
<importOrder>
<!--suppress UnresolvedMavenProperty -->
<file>${maven.multiModuleProjectDirectory}/spotless.importorder</file>
</importOrder>
</java>
<pom>
<sortPom>
<encoding>UTF-8</encoding>
<keepBlankLines>true</keepBlankLines>
<indentBlankLines>false</indentBlankLines>
<nrOfIndentSpace>2</nrOfIndentSpace>
<expandEmptyElements>false</expandEmptyElements>
<spaceBeforeCloseEmptyElement>true</spaceBeforeCloseEmptyElement>
<sortDependencies>groupId,artifactId</sortDependencies>
<sortDependencyExclusions>groupId,artifactId</sortDependencyExclusions>
<sortDependencyManagement>groupId,artifactId</sortDependencyManagement>
<sortPlugins>groupId,artifactId</sortPlugins>
<sortProperties>false</sortProperties>
<sortModules>true</sortModules>
<sortExecutions>true</sortExecutions>
<predefinedSortOrder>recommended_2008_06</predefinedSortOrder>
</sortPom>
</pom>
<ratchetFrom>origin/main</ratchetFrom>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.7.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.central</groupId>
Expand Down Expand Up @@ -330,5 +175,4 @@
</build>
</profile>
</profiles>

</project>
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
/* Licensed under MIT 2025. */
package edu.kit.kastel.mcse.ardoco.naer.model;

import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.*;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand All @@ -20,11 +17,11 @@ public class NamedEntity {
/**
* alternative names of the entity, e.g., if the name is ambiguous
*/
private final Set<String> alternativeNames;
private final SortedSet<String> alternativeNames;
/**
* all occurrences of the entity in the {@link #sourceText}
*/
private final Set<Occurrence> occurrences;
private final SortedSet<Occurrence> occurrences;
private String name;
/**
* the software architecture documentation (text) in which the named entity has been recognized
Expand All @@ -46,8 +43,8 @@ private NamedEntity(@JsonProperty("name") String name, @JsonProperty("type") Nam
@JsonProperty("alternativeNames") List<String> alternativeNames, @JsonProperty("occurrences") List<Occurrence> occurrences) {
this.name = name;
this.type = type;
this.alternativeNames = new HashSet<>(alternativeNames);
this.occurrences = new HashSet<>(occurrences);
this.alternativeNames = new TreeSet<>(alternativeNames);
this.occurrences = new TreeSet<>(occurrences);
}

/**
Expand All @@ -60,8 +57,8 @@ private NamedEntity(@JsonProperty("name") String name, @JsonProperty("type") Nam
public NamedEntity(String name, NamedEntityType type) {
this.name = name;
this.type = type;
this.alternativeNames = new HashSet<>();
this.occurrences = new HashSet<>();
this.alternativeNames = new TreeSet<>();
this.occurrences = new TreeSet<>();
}

@Nullable
Expand Down Expand Up @@ -101,7 +98,7 @@ public NamedEntityType getType() {
*
* @return a set of strings representing alternative names for this entity
*/
public Set<String> getAlternativeNames() {
public SortedSet<String> getAlternativeNames() {
return alternativeNames;
}

Expand All @@ -122,7 +119,7 @@ public void makeAllNamesLowerCase() {
this.name = this.name.toLowerCase();
}

Set<String> lowercasedAlternativeNames = new HashSet<>();
SortedSet<String> lowercasedAlternativeNames = new TreeSet<>();
for (String alternativeName : this.alternativeNames) {
if (alternativeName != null) {
lowercasedAlternativeNames.add(alternativeName.toLowerCase());
Expand All @@ -138,8 +135,8 @@ public void makeAllNamesLowerCase() {
*
* @return a set of unique integers representing the line/sentence numbers in which the entity is mentioned (line numbers are 1-indexed).
*/
public Set<Integer> getOccurrenceLines() {
Set<Integer> result = new HashSet<>();
public SortedSet<Integer> getOccurrenceLines() {
SortedSet<Integer> result = new TreeSet<>();
for (Occurrence occurrence : occurrences) {
result.add(occurrence.sentenceNumber);
}
Expand Down Expand Up @@ -184,7 +181,7 @@ public String toString() {
* @param sentenceNumber starting at {@code 1}
* @param referenceType type of how the entity is referenced
*/
private record Occurrence(int sentenceNumber, NamedEntityReferenceType referenceType) {
private record Occurrence(int sentenceNumber, NamedEntityReferenceType referenceType) implements Comparable<Occurrence> {
@JsonCreator
private Occurrence(@JsonProperty("line") int sentenceNumber, @JsonProperty("referenceType") NamedEntityReferenceType referenceType) {
this.sentenceNumber = sentenceNumber;
Expand All @@ -196,5 +193,14 @@ private Occurrence(@JsonProperty("line") int sentenceNumber, @JsonProperty("refe
public String toString() {
return sentenceNumber + ":" + referenceType;
}

@Override
public int compareTo(@NotNull Occurrence o) {
int cmp = Integer.compare(this.sentenceNumber, o.sentenceNumber);
if (cmp != 0) {
return cmp;
}
return this.referenceType.compareTo(o.referenceType);
}
}
}
Loading