CINXE.COM
LTWA search
<!DOCTYPE html> <head> <meta charset = 'utf-8'> <title>LTWA search</title> <script src='https://code.jquery.com/jquery-3.2.1.min.js' integrity='sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=' crossorigin='anonymous'></script> <script src='browserBundle.js'></script> <script> 'use strict'; /** @type {AbbrevIso.AbbrevIso} */ let abbrevIso; /** * Returns a wrapping function: as long as it continues to be invoked, * `f` will not be triggered. It will be called after it stops being called * for `wait` milliseconds. * @param {function} f * @param {*} wait - number of milliseconds required without another call * @return {function} */ function debounce(f, wait) { let timeout; return function() { const context = this; /* eslint-disable-line no-invalid-this */ const args = arguments; /* eslint-disable-line prefer-rest-params */ const later = function() { timeout = null; f.apply(context, args); }; clearTimeout(timeout); timeout = setTimeout(later, wait); }; }; /** * Processes the string given by the user in the form input and show results. */ function onInputChange() { const value = $('#inputText')[0].value; // Ignore short values. if (value.trim().length < 4) { $('#info2').html(''); // Clear the 'searching...'. return; } const result = abbrevIso.makeAbbreviation(value); $('#resultString').text(result); // Find and list all matching patterns (without excluding overlaps). const matchingPatterns = abbrevIso.getMatchingPatterns(value); const weakPatterns = abbrevIso.getMatchingPatterns(value, ['*'], true); const header = '<th>Words</th><th>Abbr.</th><th><a ' + 'href="https://www.loc.gov/standards/iso639-2/php/code_list.php">' + 'Languages</a></th>'; $('#matchingPatterns').html(header); $('#weakPatterns').html(header); for (const pattern of weakPatterns) { const row = document.createElement('tr'); row.innerHTML = '<td>' + pattern.pattern + '</td><td>' + pattern.replacement + '</td><td>' + pattern.languages.sort().join(',') + '</td>'; if (matchingPatterns.includes(pattern)) $('#matchingPatterns').append(row); else $('#weakPatterns').append(row); } $('#info2').html(''); // Clear the 'searching...'. }; $(document).ready(function() { // Handle API: read parameters from GET into the HTML form. let r = new RegExp('[\?&]search=([^&#]*)', 'i').exec(window.location.href); if (r && r[1]) $('#inputText').val(decodeURIComponent(r[1]).replace(/_/g, ' ')); // Load the LTWA table, short words list, and tests. const ltwaAjax = $.ajax({ mimeType: 'text/plain; charset=utf-8', url: 'LTWA_20210702-modified.csv', dataType: 'text', }); const shortWordsAjax = $.ajax({ mimeType: 'text/plain; charset=utf-8', url: 'shortwords.txt', dataType: 'text', }); $.when(ltwaAjax, shortWordsAjax).done( (ltwa, shortWords) => { ltwa = ltwa[0]; shortWords = shortWords[0]; abbrevIso = new AbbrevIso.AbbrevIso(ltwa, shortWords); $('#info').html('Loaded ' + abbrevIso.size + ' rows.'); // We're ready to parse, so enable the interface and doTheMatching(); $('#inputText').on('input', debounce(() => { // The zero timeout allows the browser to refresh the GUI // and draw '(searching...)'. $('#info2').html('(searching...)'); setTimeout(onInputChange, 0); }, 300) ); $('#info2').html('(searching...)'); setTimeout(onInputChange, 0); } ); }); </script> <script async defer data-domain="marcinwrochna.github.io" src="https://plausible.blekot.pl/js/plozible.js"></script> <style> #container { max-width: 620px; margin: auto; } table { border: none; border-collapse: collapse; } td, th { border-left: 1px solid gray; border-right: 1px solid gray; padding: 5px; } td:nth-child(1) { min-width: 9em; } td:nth-child(2) { min-width: 9em; } td:nth-child(3) { min-width: 2em; } tr:nth-child(even) { background-color: #ddeeee; } #info { font-size: 0.9em; } input[type=text] { min-width: 32em; margin-top: 5px; margin-bottom: 5px; } h1 { font-size: 1.2em; margin-bottom: 10px; } p { margin: 0; } ul { margin: 0.5em; } #resultString { display: block; margin: 0.9em; font-style: italic; } a { color: #337; text-decoration: none; } </style> </head> <body> <div id='container'> <form action='javascript:void(0);'> <h1>List of Title Word Abbreviations</h1> <br/> <span id='info'>Loading...</span> <span id='info2'></span> <br/> <input id='inputText' type='text' value='International Journal of Geographical Information Science' /><br/> <table id='matchingPatterns' class='patterns'></table> <br/> Probably standard ISO-4 abbreviation:<br/> <span id='resultString'></span><br/> Unused patterns that could match as compound words: <table id='weakPatterns' class='patterns'></table> <br/> <p>Some caveats: <ul> <li>Sometimes the LTWA only includes an entry that should be inflected (if <i>equilibria</i> is not abbreviated, check <i>equilibrium</i>).</li> <li>Look for compounds words (if <i>bioengineering</i> is not abbreviated, check if <i>engineering</i> appears on the list of possible compounds).</li> <li>Names of persons should not be abbreviated, even if they match.</li> <li>Every rule applies to every language (not only those listed). However, if two rules contradict, check the <i>languages</i> column to see which meaning was intended (e.g. <i>Real sociedad</i> vs <i>Real number</i>). </li> </ul> </p> <br/> <p>See the <a href='https://web.archive.org/web/20180328190032/http://www.uai.cl/images/sitio/biblioteca/citas/ISO_4_1997en.pdf/'>ISO-4</a> for general rules, e.g.: <ul> <li>articles, conjunctions and prepositions are omitted (except prepositions at the beginning, like <i>From zero to hero</i>, or locutions like <i>in vivo</i>);</li> <li>commas are removed, periods are replaced by commas, other punctuation is preserved;</li> <li>capitalization is not specified;</li> <li>diacritics are left as in the original title;</li> <li>words like <i>Part</i>, <i>Series</i>, <i>Section</i> should be omitted;</li> <li>single word titles (possibly with an article or preposition) are not abbreviated;</li> <li><i>n.a.</i> or <i>–</i> means not abbreviated.</li> </ul> </p> <br/> <p>Based on the 2021-07-02 version of the <a href='http://www.issn.org/services/online-services/access-to-the-ltwa/'>LTWA</a> (latest as of 2023-09-01).</p> <p><small>Report issues at <a href='https://github.com/marcinwrochna/abbrevIso'>GitHub</a></small></p> </form> </div> </body> </html>