Home

Awesome

abbrevIso

Publication title abbreviation per ISO-4 standard. Try it live!

This is a library for finding abbreviations of journal titles and searching LTWA (List of Title Word Abbreviations). See here for an overview of ISO-4 rules and caveats. Or try the API instead.

International Journal of Geographical Information Science → Int. J. Geogr. Inf. Sci.
Zeitschrift für deutsches Altertum und deutsche Literatur → Z. dtsch. Altert. dtsch. Lit.
4OR-A Quarterly Journal of Operations Research → 4OR-Q. J. Oper. Res.

There is also a Python bot using this library for maintaining redirects on Wikipedia.

Using

abbrevIso.makeAbbreviation(s) outputs the computed abbreviation for the given title s.

abbrevIso.getMatchingPatterns(s) returns all patterns matching s, sorted by start index of match. The patterns are returned as a list of objects with the following properties:

The library is designed for mass use, so the abbrevIso object is created once, slowly generating an index, but once this is done, queries should be fast.

Running

You need 3 files to run the library yourself:

In browsers

The library can be run in a browser as follows (loading auxilliary files using jQuery ajax):

<script
	src="https://code.jquery.com/jquery-3.3.1.min.js"
	integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
	crossorigin="anonymous"></script>
<script src="browserBundle.js"></script>
<script>
	let ltwaAjax = $.ajax({
		mimeType: 'text/plain; charset=utf-8',
		url: 'LTWA_20210702-modified.csv',
		dataType: 'text',
	});
	let shortWordsAjax = $.ajax({
		mimeType: 'text/plain; charset=utf-8',
		url: 'shortwords.txt',
		dataType: 'text',
	});
	$.when(ltwaAjax, shortWordsAjax).done( (ltwa, shortWords) => {
		abbrevIso = new AbbrevIso.AbbrevIso(ltwa[0], shortWords[0]);
		let s = 'International Journal of Geographical Information Science';
		console.log(abbrevIso.makeAbbreviation(s));
	});
</script>  

Note that the ajax may fail if loading this locally using file:// in Chrome. You can instead start a basic server that will host the current working directory at http://localhost:8000 simply by running python3 -m http.server.

In Node.js

You can run the library on any PC as follows:

let fs = require('fs');
let AbbrevIso = require('./nodeBundle.js');

let ltwa = fs.readFileSync('LTWA_20210702-modified.csv', 'utf8');
let shortWords = fs.readFileSync('shortwords.txt', 'utf8');
let abbrevIso = new AbbrevIso.AbbrevIso(ltwa, shortWords);

let s = 'International Journal of Geographical Information Science';
console.log(abbrevIso.makeAbbreviation(s));

Compiling (bundling/repackaging)

In case you need to change the library, you will need to repackage it. This is because the library is arranged in ECMAScript 6 modules, which are not well supported yet. Fortunately it suffices to repackage it using rollup.js (which can be installed from your repository or using npm, the Node.js package manager, like: sudo npm install --global rollup).

To create the browser bundle:

rollup AbbrevIso.js -o browserBundle.js --f iife --name AbbrevIso

To create the Node.js bundle:

rollup AbbrevIso.js -o nodeBundle.js --f cjs --name AbbrevIso