示例#1
0
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);
    $wordLen = count($wordSyll);
    $wordMatra = $ptreeA->GetMatraCount($wordL);
    # Selectors based on options
    if ($_POST['todaiSel'] == "none") {
        $todaiSel = True;
    } else {
        if ($_POST['todaiSel'] == "etukai") {
            $todaiSel = $ptreeA->checkEtukai($source, $wordL);
        } else {
            if ($_POST['todaiSel'] == "monai") {
                $todaiSel = $ptreeA->checkMonai($source, $wordL);
            } else {
                if ($_POST['todaiSel'] == "iyaipu") {
                    $todaiSel = $ptreeA->checkIyaipu($source, $wordL);
示例#2
0
 /**
  * Class Constructor
  *
  * @param String $ProsodyText        	
  * @param String $InterfaceLang        	
  */
 function __construct($ProsodyText, $InterfaceLang, $uyirU = False)
 {
     $ProsodyText = trim(tam2lat($ProsodyText));
     if ($uyirU) {
         $ProsodyText = preg_replace("/([kcTpR]u)(\\s)(_[aAiIuUeEoO])/", '($1)$2$3', $ProsodyText);
         $ProsodyText = preg_replace("/([kcTpR]u)(\\s*\n)(_[aAiIuUeEoO])/", '($1)$2$3', $ProsodyText);
         $_POST['ttxt'] = lat2tam($ProsodyText);
     }
     $this->InputSourceText = $ProsodyText;
     // Assigining Source Text to the
     // Variable
     $this->LetterCount = $this->GetLetterCount($ProsodyText);
     $this->ParseTreeRoot[] = $this->GetTextSyllablePattern($ProsodyText);
     $this->VikalpaCount = $this->GetVikalpaCount();
     $this->WordBond = $this->GetWordBond($this->ParseTreeRoot);
     $this->LineClass = $this->GetLineClass($this->ParseTreeRoot);
     $this->MetreType = $this->GetMetreType($this->ParseTreeRoot);
     $this->Lang = $InterfaceLang;
     // interface language
 }