Skip to content

Commit 59a6567

Browse files
committed
Remove abbreviations & Cache
1 parent a6d89a6 commit 59a6567

22 files changed

+68
-1391
lines changed

framework/common/pom.xml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,6 @@
4040
<groupId>org.apache.commons</groupId>
4141
<artifactId>commons-text</artifactId>
4242
</dependency>
43-
<dependency>
44-
<groupId>org.apache.jena</groupId>
45-
<artifactId>jena-arq</artifactId>
46-
<version>4.10.0</version>
47-
</dependency>
48-
<dependency>
49-
<groupId>org.apache.jena</groupId>
50-
<artifactId>jena-core</artifactId>
51-
<version>4.10.0</version>
52-
</dependency>
5343
<dependency>
5444
<groupId>org.apache.opennlp</groupId>
5545
<artifactId>opennlp-tools</artifactId>
@@ -72,11 +62,6 @@
7262
<artifactId>jgrapht-core</artifactId>
7363
<version>${jgrapht.version}</version>
7464
</dependency>
75-
<dependency>
76-
<groupId>org.jsoup</groupId>
77-
<artifactId>jsoup</artifactId>
78-
<version>1.17.2</version>
79-
</dependency>
8065
<dependency>
8166
<groupId>org.xerial</groupId>
8267
<artifactId>sqlite-jdbc</artifactId>

framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/stage/textextraction/PhraseAbbreviation.java

Lines changed: 0 additions & 54 deletions
This file was deleted.

framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/stage/textextraction/TextState.java

Lines changed: 5 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
/* Licensed under MIT 2021-2024. */
22
package edu.kit.kastel.mcse.ardoco.core.api.stage.textextraction;
33

4-
import java.util.Optional;
5-
64
import org.eclipse.collections.api.factory.Lists;
7-
import org.eclipse.collections.api.factory.SortedSets;
85
import org.eclipse.collections.api.list.ImmutableList;
96
import org.eclipse.collections.api.list.MutableList;
107
import org.eclipse.collections.api.map.sorted.ImmutableSortedMap;
@@ -15,7 +12,6 @@
1512
import edu.kit.kastel.mcse.ardoco.core.api.text.Phrase;
1613
import edu.kit.kastel.mcse.ardoco.core.api.text.Word;
1714
import edu.kit.kastel.mcse.ardoco.core.common.tuple.Pair;
18-
import edu.kit.kastel.mcse.ardoco.core.common.util.AbbreviationDisambiguationHelper;
1915
import edu.kit.kastel.mcse.ardoco.core.configuration.IConfigurable;
2016
import edu.kit.kastel.mcse.ardoco.core.data.Confidence;
2117
import edu.kit.kastel.mcse.ardoco.core.data.PipelineStepData;
@@ -42,7 +38,7 @@ public interface TextState extends IConfigurable, PipelineStepData {
4238
* @param probability probability to be a name mapping
4339
*/
4440
default NounMapping addNounMapping(Word word, MappingKind kind, Claimant claimant, double probability) {
45-
return getTextStateStrategy().addOrExtendNounMapping(word, kind, claimant, probability, Lists.immutable.with(word.getText()));
41+
return this.getTextStateStrategy().addOrExtendNounMapping(word, kind, claimant, probability, Lists.immutable.with(word.getText()));
4642
}
4743

4844
/**
@@ -56,7 +52,7 @@ default NounMapping addNounMapping(Word word, MappingKind kind, Claimant claiman
5652
* @param surfaceForms list of the appearances of the mapping
5753
*/
5854
default NounMapping addNounMapping(Word word, MappingKind kind, Claimant claimant, double probability, ImmutableList<String> surfaceForms) {
59-
return getTextStateStrategy().addOrExtendNounMapping(word, kind, claimant, probability, surfaceForms);
55+
return this.getTextStateStrategy().addOrExtendNounMapping(word, kind, claimant, probability, surfaceForms);
6056
}
6157

6258
/**
@@ -74,7 +70,7 @@ default NounMapping addNounMapping(Word word, MappingKind kind, Claimant claiman
7470
*/
7571
default NounMapping addNounMapping(ImmutableSortedSet<Word> words, MappingKind kind, Claimant claimant, double probability,
7672
ImmutableList<Word> referenceWords, ImmutableList<String> surfaceForms, String reference) {
77-
return getTextStateStrategy().addNounMapping(words, kind, claimant, probability, referenceWords, surfaceForms, reference);
73+
return this.getTextStateStrategy().addNounMapping(words, kind, claimant, probability, referenceWords, surfaceForms, reference);
7874
}
7975

8076
/**
@@ -90,7 +86,7 @@ default NounMapping addNounMapping(ImmutableSortedSet<Word> words, MappingKind k
9086
*/
9187
default NounMapping addNounMapping(ImmutableSortedSet<Word> words, ImmutableSortedMap<MappingKind, Confidence> distribution,
9288
ImmutableList<Word> referenceWords, ImmutableList<String> surfaceForms, String reference) {
93-
return getTextStateStrategy().addNounMapping(words, distribution, referenceWords, surfaceForms, reference);
89+
return this.getTextStateStrategy().addNounMapping(words, distribution, referenceWords, surfaceForms, reference);
9490
}
9591

9692
/**
@@ -137,7 +133,7 @@ default NounMapping addNounMapping(ImmutableSortedSet<Word> words, ImmutableSort
137133
* @param phrase the phrase
138134
*/
139135
default ImmutableList<PhraseMapping> getPhraseMappings(Phrase phrase) {
140-
return Lists.immutable.fromStream(getPhraseMappings().stream().filter(pm -> pm.getPhrases().contains(phrase)));
136+
return Lists.immutable.fromStream(this.getPhraseMappings().stream().filter(pm -> pm.getPhrases().contains(phrase)));
141137
}
142138

143139
ImmutableList<NounMapping> getNounMappingsOfKind(MappingKind mappingKind);
@@ -166,78 +162,4 @@ void mergePhraseMappingsAndNounMappings(PhraseMapping phraseMapping, PhraseMappi
166162
boolean isWordContainedByMappingKind(Word word, MappingKind kind);
167163

168164
ImmutableList<NounMapping> getNounMappingsWithSimilarReference(String reference);
169-
170-
/**
171-
* Adds a {@link WordAbbreviation} for the abbreviation with the specified word meaning to the state using the state's {@link TextStateStrategy}.
172-
*
173-
* @param abbreviation the abbreviation
174-
* @param word the meaning
175-
* @return the resulting word abbreviation in the state
176-
*/
177-
default WordAbbreviation addWordAbbreviation(String abbreviation, Word word) {
178-
logger.debug("Added word abbreviation for {} with meaning {}", abbreviation, word.getText());
179-
var wordAbbreviation = getTextStateStrategy().addOrExtendWordAbbreviation(abbreviation, word);
180-
AbbreviationDisambiguationHelper.addTransient(wordAbbreviation);
181-
return wordAbbreviation;
182-
}
183-
184-
/**
185-
* Adds a {@link PhraseAbbreviation} for the abbreviation with the specified phrase meaning to the state using the state's {@link TextStateStrategy}.
186-
*
187-
* @param abbreviation the abbrevation
188-
* @param phrase the meaning
189-
* @return the resulting phrase abbreviation in the state
190-
*/
191-
default PhraseAbbreviation addPhraseAbbreviation(String abbreviation, Phrase phrase) {
192-
logger.debug("Added phrase abbreviation for {} with meaning {}", abbreviation, phrase.getText());
193-
var phraseAbbreviation = getTextStateStrategy().addOrExtendPhraseAbbreviation(abbreviation, phrase);
194-
AbbreviationDisambiguationHelper.addTransient(phraseAbbreviation);
195-
return phraseAbbreviation;
196-
}
197-
198-
/**
199-
* {@return all word abbreviations from the state}
200-
*/
201-
ImmutableSortedSet<WordAbbreviation> getWordAbbreviations();
202-
203-
/**
204-
* {@return all word abbreviations from the state that have the specified meaning}
205-
*
206-
* @param word the meaning to search for
207-
*/
208-
default ImmutableSortedSet<WordAbbreviation> getWordAbbreviations(Word word) {
209-
return SortedSets.immutable.ofAll(getWordAbbreviations().stream().filter(w -> w.getWords().contains(word)).toList());
210-
}
211-
212-
/**
213-
* {@return the optional word abbreviation from the state that has the specified abbreviation}
214-
*
215-
* @param abbreviation the abbreviation
216-
*/
217-
default Optional<WordAbbreviation> getWordAbbreviation(String abbreviation) {
218-
return getWordAbbreviations().stream().filter(w -> w.getAbbreviation().equals(abbreviation)).findFirst();
219-
}
220-
221-
/**
222-
* {@return all phrase abbreviations from the state}
223-
*/
224-
ImmutableSortedSet<PhraseAbbreviation> getPhraseAbbreviations();
225-
226-
/**
227-
* {@return all phrase abbreviations from the state that have the specified meaning}
228-
*
229-
* @param phrase the meaning to search for
230-
*/
231-
default ImmutableSortedSet<PhraseAbbreviation> getPhraseAbbreviations(Phrase phrase) {
232-
return SortedSets.immutable.ofAll(getPhraseAbbreviations().stream().filter(p -> p.getPhrases().contains(phrase)).toList());
233-
}
234-
235-
/**
236-
* {@return the optional phrase abbreviation from the state that has the specified abbreviation}
237-
*
238-
* @param abbreviation the abbreviation
239-
*/
240-
default Optional<PhraseAbbreviation> getPhraseAbbreviation(String abbreviation) {
241-
return getPhraseAbbreviations().stream().filter(p -> p.getAbbreviation().equals(abbreviation)).findFirst();
242-
}
243165
}

framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/stage/textextraction/TextStateStrategy.java

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import org.eclipse.collections.api.map.sorted.ImmutableSortedMap;
1010
import org.eclipse.collections.api.set.sorted.ImmutableSortedSet;
1111

12-
import edu.kit.kastel.mcse.ardoco.core.api.text.Phrase;
1312
import edu.kit.kastel.mcse.ardoco.core.api.text.Word;
1413
import edu.kit.kastel.mcse.ardoco.core.common.AggregationFunctions;
1514
import edu.kit.kastel.mcse.ardoco.core.data.Confidence;
@@ -120,25 +119,5 @@ default String calculateNounMappingReference(ImmutableList<Word> referenceWords)
120119
return refBuilder.toString();
121120
}
122121

123-
/**
124-
* Tries to add a word abbreviation to the state. If the abbreviation already exists, it is extended.
125-
*
126-
* @param abbreviation the abbreviation
127-
* @param word the word
128-
* @return the resulting {@link edu.kit.kastel.mcse.ardoco.core.api.Disambiguation} in the stage
129-
*/
130-
131-
WordAbbreviation addOrExtendWordAbbreviation(String abbreviation, Word word);
132-
133-
/**
134-
* Tries to add a phrase abbreviation to the state. If the abbreviation already exists, it is extended.
135-
*
136-
* @param abbreviation the abbreviation
137-
* @param phrase the phrase
138-
* @return the resulting {@link edu.kit.kastel.mcse.ardoco.core.api.Disambiguation} in the stage
139-
*/
140-
141-
PhraseAbbreviation addOrExtendPhraseAbbreviation(String abbreviation, Phrase phrase);
142-
143122
ImmutableList<NounMapping> getNounMappingsWithSimilarReference(String reference);
144123
}

framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/stage/textextraction/WordAbbreviation.java

Lines changed: 0 additions & 50 deletions
This file was deleted.

framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/common/tuple/Pair.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,19 @@
22
package edu.kit.kastel.mcse.ardoco.core.common.tuple;
33

44
import java.io.Serializable;
5-
6-
import com.github.jsonldjava.shaded.com.google.common.base.Objects;
5+
import java.util.Objects;
76

87
public record Pair<T extends Serializable, U extends Serializable>(T first, U second) implements Serializable {
98

109
public boolean hasElement(Serializable element) {
11-
return Objects.equal(this.first, element) || Objects.equal(this.second, element);
10+
return Objects.equals(this.first, element) || Objects.equals(this.second, element);
1211
}
1312

1413
public Serializable getOtherElement(Serializable element) {
15-
if (Objects.equal(this.first, element)) {
14+
if (Objects.equals(this.first, element)) {
1615
return this.second;
1716
}
18-
if (Objects.equal(this.second, element)) {
17+
if (Objects.equals(this.second, element)) {
1918
return this.first;
2019
}
2120
throw new IllegalArgumentException("Unknown element: " + element);

0 commit comments

Comments
 (0)