What it does
It scans Tamil verse the traditional way (அலகிடுதல்). Letters group into அசை, அசை into சீர், and neighbouring சீர் must link by the rules (தளை). It says whether a couplet is a குறள் வெண்பா and, if not, why. Building It’s on GitHub now and goes to PyPI in the next release.
from uraikal.yaappu import alakidu, check_kural
kural = "வேண்டுதல் வேண்டாமை இலானடி சேர்ந்தார்க்கு\nயாண்டும் இடும்பை இல"
[(seer, name) for seer, _, name in alakidu(kural)]
# [('வேண்டுதல்வேண்', 'கூவிளங்காய்'), ('டாமை', 'தேமா'), ('யிலானடி', 'கருவிளம்'),
# ('சேர்ந்தார்க்', 'தேமா'), ('கியாண்டு', 'புளிமா'), ('மிடும்பை', 'புளிமா'), ('யில', 'மலர்')]
check_kural("அகர முதல எழுத்தெல்லாம் ஆதி\nபகவன் முதற்றே உலகம்")
# ['வுலகம்: புளிமா is not allowed at the end']
Why the சீர் cross words
Traditional scansion reads a couplet as one stream, after the letters change where words meet (புணர்ச்சி). Then it divides the stream into seven சீர். So சேர்ந்தார்க்கு யாண்டும் scans as சேர்ந்தார்க் கியாண்டு. The checker finds this division by itself, and it matches the one in traditional texts that print the Kural split into சீர்.
How well it works
- All 1,330 Kurals scan as குறள் வெண்பா. We used Tamil Wikisource’s text and corrected 9 typing slips, each against a second transcription.
- It rarely mistakes prose for verse. Only 0.35% of random seven-word stretches of web Tamil pass (7 of 2,000).
- One rule is our own finding. ஃ usually acts as a consonant, but four Kurals only scan if it counts as a short letter, so the checker allows both. A prosody scholar hasn’t checked this yet.
Source
yaappu.py