Example #1
0
/*
 * Copyright (C) 2015 Vinodh Rajan vinodh@virtualvinodh.com
 *
 * This file is a part
 * of Avalokitam. Avalokitam is free software: you can redistribute it and/or
 * modify it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or (at your
 * option) any later version. This program is distributed in the hope that it
 * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General
 * Public License for more details. You should have received a copy of the GNU
 * Affero General Public License along with this program. If not, see
 * <http://www.gnu.org/licenses/>.
 */
require_once "parsetreeclass.php";
@($ptreeA = new ProsodyParseTree("", "", ""));
# The Wordlist was extracted from Wiktionary
$wordListCont = file_get_contents('http://www.avalokitam.com/wordlists/wordListWikt.txt');
$wordList = explode("\n", $wordListCont);
$source = trim(tam2lat($_POST['source']));
$sourceSyll = str_split($source, 2);
$sourceLen = count($sourceSyll);
$sourceMatra = $ptreeA->GetMatraCount($source);
$matchList = [];
#$wordList = array_splice($wordList,0,2000);
foreach ($wordList as $wordPair) {
    $wordSplit = explode(",", $wordPair);
    $word = trim($wordSplit[0]);
    $vaypatu = trim($wordSplit[1]);
    $wordL = tam2lat($word);
    $wordSyll = str_split($wordL, 2);
Example #2
0
Reads the verse from standard input if input file not provided

';
} else {
    if (isset($options['file'])) {
        $verse = file_get_contents($options['file']);
    } else {
        $verse = file_get_contents('php://stdin');
    }
    if ($options['lang'] == 'en') {
        $lang = 'en';
    } else {
        $lang = 'ta';
    }
    $ptree = new ProsodyParseTree($verse, $lang);
    if (isset($options['xml'])) {
        echo $ptree->DisplayXML();
        echo "end";
    } else {
        $xml = simplexml_load_string($ptree->DisplayXML());
        echo "\n";
        if (isset($options['verse'])) {
            echo lancon($verse, $lang) . "\n\n";
        }
        if (isset($options['type']) || !$showPartial) {
            echo lancon(lat2tam($ptree->MetreType), $lang);
            echo "\n\n";
        }
        if (isset($options['count']) || !$showPartial) {
            echo lancon(lat2tam("_uyireZu_ttu"), $lang) . " " . $ptree->LetterCount['Vowel'] . "\n";
Example #3
0
			<form action="/" method="post">
				<p>
					<textarea cols="80" rows="8" id="itext" name="ttxt">
<?php 
if (!$formsubmit) {
    ?>
மாதவா போதி வரதா வருளமலா
பாதமே யோத சுரரைநீ - தீதகல
மாயா நெறியளிப்பா யின்றன் பகலாச்சீர்த்
தாயே யலகில்லா டாம்
<?php 
} else {
    if (isset($_POST['kurilU'])) {
        $uyirU = TRUE;
    }
    $ptree = new ProsodyParseTree($_POST['ttxt'], $lang, $uyirU);
    if (strpos($_POST['ttxt'], "மாதவா போதி வரதா வருளமலா") === false) {
        $hashkey = insert_datastore($_POST['ttxt']);
    }
    echo $_POST['ttxt'];
}
?>
</textarea>
				
				
				<p>
					<input type="submit"
						value=<?php 
echo lanconTrnL("ஆராய்க", $_SESSION['lang']);
?>
						id="submit" class="uiTran" />
Example #4
0
 * Affero General Public License along with this program. If not, see
 * <http://www.gnu.org/licenses/>.
 */
Header('Content-type: text/xml');
ob_start();
require_once "parsetreeclass.php";
ob_end_clean();
// API for Avalokitam
// Returns an XML for a post request with the following parameters
// Verse - Verse in Tamil Unicode
// Langa - en or ta ; Default ta
// Kurilu - 0 or 1 ; Default 0
if (isset($_REQUEST['verse'])) {
    if (isset($_REQUEST['lang'])) {
        $lang = $_REQUEST['lang'];
    } else {
        $lang = 'ta';
    }
    if ($_REQUEST['kurilu'] == 1) {
        $kurilu = True;
    } else {
        $kurilu = False;
    }
    if ($_REQUEST['vencheck'] == 1) {
        $vencheck = True;
    } else {
        $vencheck = False;
    }
    $ptree = new ProsodyParseTree($_REQUEST['verse'], $lang, $kurilu);
    echo $ptree->DisplayXML($venCheck = $vencheck);
}