Thank you so much for this explanation. Still trying to understand what it completely. But so far can induce:
1. Sandhi or phonology should drive all noun and verb inflection.
2. Sanskrit grammarians and/or natural language software creators probably already have systematic ways to deal with these irregular noun declensions.
3. For software, probably don't want to go all the way back to the Vedic historical linguistic origins of the irregular inflection, though want to thoroughly understand what is going on here.