pierre-24 / pyiso4

Implementation of the ISO 4 standard for journal titles abbreviations in Python.
MIT License
4 stars 2 forks source link

Already abbreviated inputs #11

Open klb2 opened 1 month ago

klb2 commented 1 month ago

I am not sure whether this is a bug or the expected behavior: If a string, which already contains (some) abbreviations, is abbreviated again, dots are changed to commas.

Example:

from pyiso4.ltwa import Abbreviate
a = Abbreviate.create()
a("IEEE Transactions on Wireless Communications")
>>> 'IEEE Trans. Wirel. Commun.'
a('IEEE Trans. Wirel. Commun.')
>>> 'IEEE Trans, Wirel, Commun,'
a("IEEE Trans. Wireless Communications")
>>> 'IEEE Trans, Wirel. Commun.'

For me, the expected behavior was to keep the dots unchanged.

pierre-24 commented 1 month ago

You are of course right: this behavior is me trying to comply with rule 7.1.6:

image

Solution might be to check in the abbreviation dictionary whether a given word is actually an abbreviation :)

klb2 commented 1 month ago

Thanks for clarifying. This seems to be a tricky problem.