One would need to tag the individual parts as Sanskrit or Tamil and then predict the Sanskrit spelling from the defective Tamil spelling. (As in both balam/phalam become பலம் (palam) in the Tamil script. Reversing it requires some amount of heuristics). There is enough training material for Manpravala though that will allow such tagging (AFAIK it is just a simple PoS tagging at the end of the day). Even, a purely heuristic rule-based prediction should more or less work.
For instance:
Input:
ஆளவந்தாருடைய நியோகத்தாலே ஶ்ரீபாஷ்யகாரரை அங்கீகரித்த பூர்ணரான பெரியநம்பி
āḷavantāruṭaiya niyōkattālē śrīpāṣyakārarai aṅkīkaritta pūrṇarāṉa periyanampi
Tagging:
<ta>āḷavantāruṭaiya</ta> <sa>niyōka</sa<ta>ttālē</ta> <sa>śrīpāṣyakā</sa><ta>rarai<ta> <sa>aṅkīka</sa><ta>ritta<ta> <sa>pūrṇa</sa><ta>rāṉa<ta> <ta>periyanampi</ta>
Output:
āḷavantāruṭaiya niyōgattālē śrībhāṣyakārarai aṅgīkaritta pūrṇarāṉa periyanampi
ஆளவந்தாருடைய नियोगத்தாலே श्रीभाष्यकारரை अङ्गीकरिத்த पूर्णराன பெரியநம்பி
-------
I suppose you've transcribed the Tamilized-Manipravala to Devangari. It probably rendered even Sanskrit words with Tamilized pronunication.
In any case dealing with Manipravala in only the Tamil script is tricky if you want to back-form the proper source text. Unfortunately, more and more publishers are printing MP text only in the Tamil script and the nuances are being lost as many Sanskrit words become very ambiguous in the Tamil script.
Cheers,
Vinodh