Implementation of ISO 4 (Rules for the abbreviation of title words and titles of publications) / CIEPS LTWA (ISSN International Centre's List of Title Word Abbreviations) as a Python library.
>>> from iso4 import abbreviate
>>> abbreviate("Recent Advances in Studies on Cardiac Structure and Metabolism")
'Recent Adv. Stud. Card. Struct. Metab.'
>>> abbreviate("Journal of the American Academy of Dermatology", periods=False)
'J Am Acad Dermatol'
>>> abbreviate("Real Living with Multiple Sclerosis")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
...
Exception: Ambiguous word in title: real; must disambiguate between langs: eng, fre, spa
>>> abbreviate("Real Living with Multiple Sclerosis", disambiguation_langs=['eng'])
'Real Living Mult. Scler.'
>>> abbreviate("Anales de la Real Academia de Farmacia", True, ['spa'])
'An. R. Acad. Farm.'
The following command will change the current line to its abbreviation
:ISO4
The command can also be used in visual mode.
- Potential future improvements:
- stricter treatment of language in general
- better fuzzy matching with diacritics
- conversion from non-Latin scripts
- Consider this function fairly hacky as is; do not expect 100% accuracy!