@@ -0,0 +1,905 @@
+#!/usr/bin/env python%0A%0Aimport sys%0Aimport os%0Aimport re%0Aimport logging%0Alogging.basicConfig(level=logging.INFO)%0A%0Areraaga = re.compile(r%22%5Cbraa?gam?%5Cb%22)%0Aretaala = re.compile(r%22%5Cbtaa?lam?%5Cb%22)%0A%0Adef has_raaga(tag):%0A    return re.search(reraaga, tag)%0A%0Adef has_taala(tag):%0A    return re.search(retaala, tag)%0A%0Adef parse_raaga(raaga):%0A    raaga = raaga.strip()%0A    number = re.search(r%22(%5B0-9%5D+)%22, raaga)%0A    if number:%0A        position = int(number.group(0))%0A    else:%0A        position = 0%0A    raaga = re.sub(r%22 ?: ?%22, %22 %22, raaga)%0A    raaga = re.sub(r%22 ?raa?gam?%5B0-9%5D* ?%22, %22%22, raaga)%0A    return (position, raaga)%0A%0Adef parse_taala(taala):%0A    taala = taala.strip()%0A    number = re.search(r%22(%5B0-9%5D+)%22, taala)%0A    if number:%0A        position = int(number.group(0))%0A    else:%0A        position = 0%0A    taala = re.sub(r%22 ?: ?%22, %22 %22, taala)%0A    taala = re.sub(r%22 ?taa?lam?%5B0-9%5D* ?%22, %22%22, taala)%0A    return (position, taala)%0A%0A

move tag parsing into lib