macro_rules! journal_abbrv {
($count:expr, [$($value:expr => $abbr:expr),* $(,)*] $(,)*) => {
const JOURNAL_HOTWORDS: [&str; $count] = [
$( $value , )*
];
const JOURNAL_ABBRV: [&str; $count] = [
$( $abbr , )*
];
}
}
journal_abbrv!(314, [
"abstracts" => "Abstr.",
"academy" => "Acad.",
"accelerator" => "Accel.",
"acoustics" => "Acoust.",
"active" => "Act.",
"administration" => "Admin.",
"administrative" => "Administ.",
"advanced" => "Adv.",
"aeronautics" => "Aeronaut.",
"aerospace" => "Aerosp.",
"affective" => "Affect.",
"africa" => "Afr.",
"african" => "Afr.",
"aircraft" => "Aircr.",
"algebraic" => "Algebr.",
"american" => "Amer.",
"analysis" => "Anal.",
"annals" => "Ann.",
"annual" => "Annu.",
"apparatus" => "App.",
"applications" => "Appl.",
"applied" => "Appl.",
"approximate" => "Approx.",
"archive" => "Arch.",
"archives" => "Arch.",
"artificial" => "Artif.",
"assembly" => "Assem.",
"association" => "Assoc.",
"astronautics" => "Astronaut.",
"astronomy" => "Astron.",
"astrophysics" => "Astrophys.",
"atmosphere" => "Atmos.",
"atomic" => "At.",
"atoms" => "At.",
"australasian" => "Australas.",
"australia" => "Aust.",
"automatic" => "Autom.",
"automation" => "Automat.",
"automotive" => "Automot.",
"autonomous" => "Auton.",
"behavior" => "Behav.",
"behavioral" => "Behav.",
"belgian" => "Belg.",
"biochemical" => "Biochem.",
"bioinformatics" => "Bioinf.",
"biological" => "Biol.",
"biology" => "Biol.",
"biomedical" => "Biomed.",
"biophysics" => "Biophys.",
"british" => "Brit.",
"broadcasting" => "Broadcast.",
"bulletin" => "Bull.",
"bureau" => "Bur.",
"business" => "Bus.",
"canadian" => "Can.",
"ceramic" => "Ceram.",
"chemical" => "Chem.",
"chinese" => "Chin.",
"climatology" => "Climatol.",
"clinical" => "Clin.",
"cognitive" => "Cogn.",
"colloquium" => "Colloq.",
"communications" => "Commun.",
"compatibility" => "Compat.",
"components" => "Compon.",
"components" => "Compon.",
"computational" => "Comput.",
"computer" => "Comput.",
"computers" => "Comput.",
"computing" => "Comput.",
"condensed" => "Condens.",
"conference" => "Conf.",
"congress" => "Congr.",
"consumer" => "Consum.",
"convention" => "Conv.",
"conversion" => "Convers.",
"correspondence" => "Corresp.",
"critical" => "Crit.",
"crystal" => "Cryst.",
"crystallography" => "Crystallogr.",
"cybernetics" => "Cybern.",
"decision" => "Decis.",
"delivery" => "Del.",
"department" => "Dept.",
"design" => "Des.",
"detector" => "Detect.",
"development" => "Develop.",
"differential" => "Differ.",
"digest" => "Dig.",
"digital" => "Digit.",
"disclosure" => "Discl.",
"discussions" => "Discuss.",
"dissertations" => "Diss.",
"distributed" => "Distrib.",
"dynamics" => "Dyn.",
"earthquake" => "Earthq.",
"economic" => "Econ.",
"economics" => "Econ.",
"edition" => "Ed.",
"education" => "Educ.",
"electrical" => "Elect.",
"electrification" => "Electrific.",
"electroacoustic" => "Electroacoust.",
"electromagnetic" => "Electromagn.",
"emerging" => "Emerg.",
"engineering" => "Eng.",
"environment" => "Environ.",
"equations" => "Equ.",
"equipment" => "Equip.",
"ergonomics" => "Ergonom.",
"european" => "Eur.",
"evaluation" => "Eval.",
"evolutionary" => "Evol.",
"exhibition" => "Exhib.",
"experimental" => "Exp.",
"exploratory" => "Explor.",
"exposition" => "Expo.",
"express" => "Electron.",
"fabrication" => "Fabr.",
"faculty" => "Fac.",
"ferroelectrics" => "Ferroelect.",
"foundation" => "Found.",
"francais" => "Fr.",
"french" => "Fr.",
"frequency" => "Freq.",
"fundamental" => "Fundam.",
"generation" => "Gener.",
"geology" => "Geol.",
"geophysics" => "Geophys.",
"geoscience" => "Geosci.",
"graphics" => "Graph.",
"guidance" => "Guid.",
"harmonic" => "Harmon.",
"harmonics" => "Harmon.",
"history" => "Hist.",
"horizon" => "Horiz.",
"hungarian" => "Hung.",
"hungary" => "Hung.",
"hydraulics" => "Hydraul.",
"hydrology" => "Hydrol.",
"illuminating" => "Illum.",
"imaging" => "Imag.",
"industrial" => "Ind.",
"informatics" => "Inform.",
"information" => "Inf.",
"innovation" => "Innov.",
"institute" => "Inst.",
"instrument" => "Instrum.",
"instrumentation" => "Instrum.",
"insulation" => "Insul.",
"integrated" => "Integr.",
"intelligence" => "Intell.",
"intelligent" => "Intell.",
"interactions" => "Interact.",
"international" => "Int.",
"isotopes" => "Isot.",
"israel" => "Isr.",
"japan" => "Jpn.",
"journal" => "J.",
"knowledge" => "Knowl.",
"laboratory" => "Lab.",
"laboratoryies" => "Lab.",
"language" => "Lang.",
"learning" => "Learn.",
"letter" => "Lett.",
"letters" => "Lett.",
"lightwave" => "Lightw.",
"logic" => "Log.",
"logical" => "Log.",
"luminescence" => "Lumin.",
"machine" => "Mach.",
"magazine" => "Mag.",
"magnetics" => "Magn.",
"management" => "Manage.",
"managing" => "Manag.",
"manufacturing" => "Manuf.",
"marine" => "Mar.",
"material" => "Mater.",
"mathematical" => "Math.",
"mathematics" => "Math.",
"measurement" => "Meas.",
"mechanical" => "Mech.",
"medical" => "Med.",
"metallurgy" => "Metall.",
"metals" => "Met.",
"meteorology" => "Meteorol.",
"metropolitan" => "Metrop.",
"mexican" => "Mex.",
"mexico" => "Mex.",
"microelectromechanical" => "Microelectromech.",
"microgravity" => "Microgr.",
"microscopy" => "Microsc.",
"microwave" => "Microw.",
"microwaves" => "Microw.",
"military" => "Mil.",
"modeling" => "Model.",
"molecular" => "Mol.",
"monitoring" => "Monit.",
"multiphysics" => "Multiphys.",
"nanobioscience" => "Nanobiosci.",
"nanotechnology" => "Nanotechnol.",
"national" => "Nat.",
"naval" => "Nav.",
"network" => "Netw.",
"networking" => "Netw.",
"newsletter" => "Newslett.",
"nondestructive" => "Nondestruct.",
"nuclear" => "Nucl.",
"numerical" => "Numer.",
"observations" => "Observ.",
"occupation" => "Occupat.",
"oceanic" => "Ocean.",
"oceanography" => "Oceanogr.",
"operational" => "Oper.",
"optical" => "Opt.",
"optics" => "Opt.",
"optimization" => "Optim.",
"organization" => "Org.",
"packaging" => "Packag.",
"particle" => "Part.",
"patent" => "Pat.",
"performance" => "Perform.",
"personal" => "Pers.",
"philosophical" => "Philos.",
"photonics" => "Photon.",
"photovoltaics" => "Photovolt.",
"physics" => "Phys.",
"physiology" => "Physiol.",
"planetary" => "Planet.",
"pneumatics" => "Pneum.",
"pollution" => "Pollut.",
"polymer" => "Polym.",
"polytechnic" => "Polytech.",
"practice" => "Pract.",
"precision" => "Precis.",
"principles" => "Princ.",
"proceedings" => "Proc.",
"processing" => "Process.",
"production" => "Prod.",
"productivity" => "Productiv.",
"programming" => "Program.",
"progress" => "Prog.",
"propagation" => "Propag.",
"psychology" => "Psychol.",
"quality" => "Qual.",
"quarterly" => "Quart.",
"radiation" => "Radiat.",
"radiology" => "Radiol.",
"reactor" => "React.",
"receivers" => "Receiv.",
"recognition" => "Recognit.",
"record" => "Rec.",
"rehabilitation" => "Rehabil.",
"reliability" => "Rel.",
"report" => "Rep.",
"research" => "Res.",
"resonance" => "Reson.",
"resources" => "Resour.",
"review" => "Rev.",
"robotics" => "Robot.",
"royal" => "Roy.",
"safety" => "Saf.",
"satellite" => "Satell.",
"scandinavian" => "Scand.",
"science" => "Sci.",
"section" => "Sect.",
"security" => "Secur.",
"seismology" => "Seismol.",
"selected" => "Sel.",
"semiconductor" => "Semicond.",
"sensing" => "Sens.",
"series" => "Ser.",
"simulation" => "Simul.",
"singapore" => "Singap.",
"sistema" => "Sist.",
"society" => "Soc.",
"sociological" => "Sociol.",
"software" => "Softw.",
"solar" => "Sol.",
"soviet" => "Sov.",
"spectroscopy" => "Spectrosc.",
"spectrum" => "Spectr.",
"speculations" => "Specul.",
"statistics" => "Statist.",
"structure" => "Struct.",
"studies" => "Stud.",
"superconductivity" => "Supercond.",
"supplement" => "Suppl.",
"surface" => "Surf.",
"survey" => "Surv.",
"sustainable" => "Sustain.",
"symposium" => "Symp.",
"systems" => "Syst.",
"technical" => "Tech.",
"techniques" => "Techn.",
"technology" => "Technol.",
"telecommunications" => "Telecommun.",
"television" => "Telev.",
"temperature" => "Temp.",
"terrestrial" => "Terr.",
"theoretical" => "Theor.",
"transactions" => "Trans.",
"translation" => "Transl.",
"transmission" => "Transmiss.",
"transportation" => "Transp.",
"tutorials" => "Tut.",
"ultrasonic" => "Ultrason.",
"university" => "Univ.",
"vacuum" => "Vac.",
"vehicular" => "Veh.",
"vibration" => "Vib.",
"visual" => "Vis.",
"welding" => "Weld.",
"working" => "Work.",
]);
pub(super) fn abbreviate_journal(title: &str) -> String {
if title.trim().to_lowercase() == "proceedings of the ieee" {
return "Proceedings of the IEEE".to_string();
}
title
.split_whitespace()
.map(|s| {
if let Ok(pos) = JOURNAL_HOTWORDS.binary_search(&s.to_lowercase().as_str()) {
JOURNAL_ABBRV[pos]
} else {
s
}
})
.filter(|s| {
crate::lang::en::NEVER_CAPITALIZE
.binary_search(&s.to_lowercase().as_str())
.is_err()
})
.collect::<Vec<_>>()
.join(" ")
}