Verified Owner
Top Description Fields Constructors Methods
org.jabref.logic.journals

public Class JournalAbbreviationRepository

extends Object
Class Inheritance
Known Direct Subclasses
org.jabref.logic.journals.JournalAbbreviationLoader.AsyncJournalAbbreviationRepository
Imports
java.nio.file.Path, java.util.Collection, .Comparator, .HashMap, .List, .Map, .Optional, .Set, .TreeSet, java.util.regex.Matcher, .Pattern, org.jabref.logic.journals.ltwa.LtwaRepository, org.jabref.logic.util.strings.StringSimilarity, org.h2.mvstore.MVMap, .MVStore, org.jspecify.annotations.NonNull

A repository for all journal abbreviations, including add and find methods.

Field Summary

Modifier and TypeField and Description
private final Map<String, Abbreviation>
private final TreeSet<Abbreviation>
private final Map<String, Abbreviation>
private final Map<String, Abbreviation>
private final LtwaRepository
pack-priv static final Pattern
private final Map<String, Abbreviation>
private final StringSimilarity

Constructor Summary

AccessConstructor and Description
public
JournalAbbreviationRepository(Path
The path to the MV file containing the journal abbreviations.
journalList
,
LtwaRepository
The LTWA repository to use for abbreviations.
ltwaRepository
)

Initializes the internal data based on the abbreviations found in the given MV file

public
JournalAbbreviationRepository()

Initializes the repository with demonstration data.

Method Summary

Modifier and TypeMethod and Description
public void
public void
private Optional<Abbreviation>
private Optional<Abbreviation>
findBestFuzzyMatched(Collection<Abbreviation> abbreviations, String input)

Fuzzy searches abbreviations

To prevent wrong matches, such as Nutrients converted to Nutrition we do fuzzy matching if the title is three words or more (or contains non-ASCII characters)

public Optional<Abbreviation>
get(String
The journal name (either full name or abbreviated name).
input
)

Attempts to get the abbreviation of the journal given.

public Collection<Abbreviation>
public Collection<Abbreviation>
public Optional<String>
public Optional<String>
public Set<String>
public Optional<String>
getLtwaAbbreviation(String journalName)

Get the LTWA abbreviation for the given journal name.

public Optional<String>
public Optional<String>
public boolean
isAbbreviatedName(String journalName)

Returns true if the given journal name is in its abbreviated form (e.g. Phys.

public boolean
isKnownName(String journalName)

Returns true if the given journal name is contained in the list either in its full form (e.g., Physical Review Letters) or its abbreviated form (e.g., Phys.

private static boolean
isMatched(String name, Abbreviation abbreviation)

private static boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

abbreviationToAbbreviationObjectback to summary
private final Map<String, Abbreviation> abbreviationToAbbreviationObject
customAbbreviationsback to summary
private final TreeSet<Abbreviation> customAbbreviations
dotlessToAbbreviationObjectback to summary
private final Map<String, Abbreviation> dotlessToAbbreviationObject
fullToAbbreviationObjectback to summary
private final Map<String, Abbreviation> fullToAbbreviationObject
ltwaRepositoryback to summary
private final LtwaRepository ltwaRepository
QUESTION_MARKback to summary
pack-priv static final Pattern QUESTION_MARK
shortestUniqueToAbbreviationObjectback to summary
private final Map<String, Abbreviation> shortestUniqueToAbbreviationObject
similarityback to summary
private final StringSimilarity similarity

Constructor Detail

JournalAbbreviationRepositoryback to summary
public JournalAbbreviationRepository(Path journalList, LtwaRepository ltwaRepository)

Initializes the internal data based on the abbreviations found in the given MV file

Parameters
journalList:Path

The path to the MV file containing the journal abbreviations.

ltwaRepository:LtwaRepository

The LTWA repository to use for abbreviations.

JournalAbbreviationRepositoryback to summary
public JournalAbbreviationRepository()

Initializes the repository with demonstration data. Used if no abbreviation file is found.

Method Detail

addCustomAbbreviationback to summary
public void addCustomAbbreviation(@NonNull Abbreviation abbreviation)
addCustomAbbreviationsback to summary
public void addCustomAbbreviations(Collection<Abbreviation> abbreviationsToAdd)
findAbbreviationFuzzyMatchedback to summary
private Optional<Abbreviation> findAbbreviationFuzzyMatched(String input)
findBestFuzzyMatchedback to summary
private Optional<Abbreviation> findBestFuzzyMatched(Collection<Abbreviation> abbreviations, String input)

Fuzzy searches abbreviations

To prevent wrong matches, such as Nutrients converted to Nutrition we do fuzzy matching if the title is three words or more (or contains non-ASCII characters)

getback to summary
public Optional<Abbreviation> get(String input)

Attempts to get the abbreviation of the journal given. if no exact match is found, attempts a fuzzy match on full journal names.

Parameters
input:String

The journal name (either full name or abbreviated name).

getAllLoadedback to summary
public Collection<Abbreviation> getAllLoaded()
getCustomAbbreviationsback to summary
public Collection<Abbreviation> getCustomAbbreviations()
getDefaultAbbreviationback to summary
public Optional<String> getDefaultAbbreviation(String text)
getDotlessback to summary
public Optional<String> getDotless(String text)
getFullNamesback to summary
public Set<String> getFullNames()
getLtwaAbbreviationback to summary
public Optional<String> getLtwaAbbreviation(String journalName)

Get the LTWA abbreviation for the given journal name.

getNextAbbreviationback to summary
public Optional<String> getNextAbbreviation(String text)
getShortestUniqueAbbreviationback to summary
public Optional<String> getShortestUniqueAbbreviation(String text)
isAbbreviatedNameback to summary
public boolean isAbbreviatedName(String journalName)

Returns true if the given journal name is in its abbreviated form (e.g. Phys. Rev. Lett.). The test is strict, i.e., journals whose abbreviation is the same as the full name are not considered

isKnownNameback to summary
public boolean isKnownName(String journalName)

Returns true if the given journal name is contained in the list either in its full form (e.g., Physical Review Letters) or its abbreviated form (e.g., Phys. Rev. Lett.). If the exact match is not found, attempts a fuzzy match to recognize minor input errors.

isMatchedback to summary
private static boolean isMatched(String name, Abbreviation abbreviation)
isMatchedAbbreviatedback to summary
private static boolean isMatchedAbbreviated(String name, Abbreviation abbreviation)