Posted 4 years, 3 months ago | Originally written on 4 Jul 2020
OK. Quick note. I've just come across a Python package for converting Arabic to Roman numerals. Great! But I think it can be improved in several ways.
- Add documentation even if just in the README file to show how to use it.
- Add an entry point for users to run it in the terminal.
- Extend the range. It currently only does conversions up to 4999. However, one can actually write Roman numerals up to several million (I can't remember the exact bound) using some interesting tricks. An overline provides a thousands multiplier (https://blog.prepscholar.com/roman-numerals-converter). The main challenge here is how to add the overline. My immediate thought was to use a unicode character. However, that falls short quite fast because I don't think there's a V with overline. Anyway, even if there is what you can do is using COMBINING DIACRITICAL MARKS (https://www.unicode.org/charts/nameslist/n_0300.html). Here's some Python code:
In [2]: chr(0x0238)+chr(0x0304)
Out[2]: 'ȸ̄'
In [3]: chr(0x0238) #+chr(0x0304)
Out[3]: 'ȸ'
The basic idea is to append the diacritical mark immediately after whatever symbol you want with an overline. The example above uses the COMBINING MACRON but you can get better results (continuous overline) using the COMBINING OVERLINE like so:
In [7]: 'V'+chr(0x0305)
Out[7]: 'V̅'
In [8]: 'I'+chr(0x0305) + 'V'+chr(0x0305)
Out[8]: 'I̅V̅'
I plan to add these features to the Python roman package.