Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/add-llm-citation-parsing' into a…
Browse files Browse the repository at this point in the history
…dd-llm-citation-parsing

# Conflicts:
#	src/test/java/org/jabref/logic/importer/WebFetchersTest.java
  • Loading branch information
InAnYan committed Oct 3, 2024
2 parents 991e8b8 + d6ee16a commit aebd8ac
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
- We added support for drag'n'drop on an entry in the maintable to an external application to get the entry preview dropped. [#11846](https://github.com/JabRef/jabref/pull/11846)
- We added a different background color to the search bar to indicate when the search syntax is wrong. [#11658](https://github.com/JabRef/jabref/pull/11658)
- We added a setting which always adds the literal "Cited on pages" text before each JStyle citation. [#11691](https://github.com/JabRef/jabref/pull/11732)
- We added a new plain citation parser that uses LLMs.
- We added a new plain citation parser that uses LLMs. [#11825](https://github.com/JabRef/jabref/issues/11825)

### Changed

Expand Down
16 changes: 12 additions & 4 deletions src/test/java/org/jabref/logic/importer/WebFetchersTest.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package org.jabref.logic.importer;

import java.util.Collection;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
import java.util.TreeSet;
import java.util.stream.Collectors;

import org.jabref.logic.FilePreferences;
Expand All @@ -13,6 +15,7 @@
import org.jabref.logic.importer.fetcher.GvkFetcher;
import org.jabref.logic.importer.fetcher.IssnFetcher;
import org.jabref.logic.importer.fetcher.JstorFetcher;
import org.jabref.logic.importer.fetcher.LlmCitationFetcher;
import org.jabref.logic.importer.fetcher.MrDLibFetcher;
import org.jabref.logic.importer.fetcher.isbntobibtex.DoiToBibtexConverterComIsbnFetcher;
import org.jabref.logic.importer.fetcher.isbntobibtex.EbookDeIsbnFetcher;
Expand Down Expand Up @@ -116,7 +119,9 @@ void getSearchBasedFetchersReturnsAllFetcherDerivingFromSearchBasedFetcher() {
Set<SearchBasedFetcher> searchBasedFetchers = WebFetchers.getSearchBasedFetchers(importFormatPreferences, importerPreferences);
try (ScanResult scanResult = classGraph.scan()) {
ClassInfoList controlClasses = scanResult.getClassesImplementing(SearchBasedFetcher.class.getCanonicalName());
Set<Class<?>> expected = new HashSet<>(controlClasses.loadClasses());

Set<Class<?>> expected = new TreeSet<>(Comparator.comparing(Class::getName));
expected.addAll(controlClasses.loadClasses());

// Some classes implement SearchBasedFetcher, but are only accessible to other fetcher, so ignore them
expected.removeAll(getIgnoredInaccessibleClasses());
Expand All @@ -132,8 +137,9 @@ void getSearchBasedFetchersReturnsAllFetcherDerivingFromSearchBasedFetcher() {
expected.remove(PagedSearchBasedParserFetcher.class);
expected.remove(PagedSearchBasedFetcher.class);

// Remove GROBID, because we don't want to show this to the user
expected.remove(GrobidPlainCitationParser.class);
// Remove GROBID and LLM, because we don't want to show this to the user (since they convert text to BibTeX)
expected.remove(GrobidCitationFetcher.class);
expected.remove(LlmCitationFetcher.class);

assertEquals(expected, getClasses(searchBasedFetchers));
}
Expand Down Expand Up @@ -178,6 +184,8 @@ void getIdFetchersReturnsAllFetcherDerivingFromIdFetcher() {
}

private Set<? extends Class<?>> getClasses(Collection<?> objects) {
return objects.stream().map(Object::getClass).collect(Collectors.toSet());
return objects.stream()
.map(Object::getClass)
.collect(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(Class::getName))));
}
}

0 comments on commit aebd8ac

Please sign in to comment.