endrain / omninumeric Goto Github PK
View Code? Open in Web Editor NEWPython module for numbers reading and writing in alphabetic numeral systems
License: MIT License
Python module for numbers reading and writing in alphabetic numeral systems
License: MIT License
By design, Cyrillic converter supports reading numbers with decorator irregularities - including missing "thousand" marks. (Whether this design is right is another question - #4.) The problem here is that certain irregularly written numbers can break current translation algorithm.
Concider this number:
раi҂ра҃i
Let's agree that all our numbers are properly written left-to right, only some decorators are missing. Now, current algorithm will not interpret this as 111,111,000 as it should. It will interpret this as 222,000. It will take the "thousand" mark from the first numeral group and index value (1) for the second numeral group. Both will yield a multiplier of 1,000. Hence, 111*1,000 + 111*1,000 = 222,000.
#5 means that Omninumeric isn't going to validate input, instead just returning zeroes or empty strings on irregular input. But it's not impossible that someone using this library will need to write some checks. To support this, regular expressions must be published by respective modules.
Refactor to conform to EAFP principle.
Some tests fail on Python 3.0-3.6:
self.assertEqual(10001010001, cu_to_arab("҂҂҂і҂҂а҂іа҃"))
AssertionError: 10001010001 != 10001000010001
self.assertEqual(18, cu_to_arab("и҃і"))
AssertionError: 18 != 8010
self.assertEqual(1015, cu_to_arab("҂ає҃і"))
AssertionError: 1015 != 1005010
Code should be refactored to support broader range of platforms.
By current design, Omninumeric tries to read from alphabetic numeral systems as permissively as possible. Numbers in ANS are not required to follow the system's rules for decorators by the book. For example, Cyrillic converter would render this:
араi
as 1,111, even though the "thousand" mark before the leftmost a
is missing.
Is this the right design choice or not?
Arguments for this design:
Arguments against this design:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.