From 3ef7391ae9b8393a7c023c0ce1cda0da82130eaf Mon Sep 17 00:00:00 2001 From: drdhaval2785 Date: Sun, 21 Feb 2016 19:15:24 +0530 Subject: [PATCH] version 1.6.0 preparation --- README.md | 4 ++ panini.php | 16 ++--- scripts/ajax.php | 4 +- scripts/function.php | 135 ++++++++++++++++++++++++++----------------- tiGanta.html | 2 +- 5 files changed, 96 insertions(+), 65 deletions(-) diff --git a/README.md b/README.md index d95140a..170910c 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,10 @@ v1.3.0 - 22 January 2016 - Commentaries available for local viewing. v1.4.0 - 3 February 2016 - Option to deactivate some sUtras of Paninian grammar, to understand its importance in the structure of Astadhyayi. +v1.5.0 - 21 February 2016 - The code is tested for representative verbs and suspect verb forms are corrected. + +v1.6.0 - 21 February 2016 - The code now has three commentaries mAdhavIyadhAtuvRtti, kSIrataraGgiNI and dhAtupradIpa for offline viewing. + # For understanding the code Read [this](https://github.com/drdhaval2785/SanskritVerb/Documentations/blob/master/understandcode.md) diff --git a/panini.php b/panini.php index fd9efec..fd3f79b 100644 --- a/panini.php +++ b/panini.php @@ -2,7 +2,7 @@ /* This code is developed by Dr. Dhaval Patel (drdhaval2785@gmail.com) of www.sanskritworld.in and Ms. Sivakumari Katuri. * Layout assistance by Mr Marcis Gasuns. * Available under GNU licence. - * Version 1.4.0 date 3 January 2016 + * Version 1.6.0 date 21 February 2016 * The latest source code is available at https://github.com/drdhaval2785/SanskritVerb . * Acknowledgements: The base book for coding has been Astadhyayi sahajabodha of Dr. Pushpa Dikshit, published by Pratibha Prakashan, Delhi. * I extend my heartfelt thanks to Ananda Loponen for the code to convert devanagari and various sanskrit transliterations. That can be accessed at http://www.ingmardeboer.nl/php/diCrunch.php?act=help. @@ -12324,20 +12324,16 @@ /* Closing the HTML */ echo " "; - fputs($outfile," - "); - fclose($outfile); + //fputs($outfile,""); + //fclose($outfile); } elseif ($type==="subanta") { - $ou = array_map('convert',$ou); tablemaker1($ou); /* Closing the HTML */ - echo " - "; - fputs($outfile," - "); - fclose($outfile); + echo ""; + //fputs($outfile,""); + //fclose($outfile); } /* Logging the end of execution in logfile */ diff --git a/scripts/ajax.php b/scripts/ajax.php index f7e6ee6..a0ec9f0 100644 --- a/scripts/ajax.php +++ b/scripts/ajax.php @@ -1024,8 +1024,8 @@ } elseif (($_POST['step']==='11' || $_POST['step']==='12' || $_POST['step']==='13') && ends($arrWord,$allverbs,2) ) { - $verbset = scrape1($word,0,9,1); - $number = scrape($word,0,8,1,"",$verbset[0],9); + $verbset = scrape1($word,0,12,1); + $number = scrape($word,0,11,1,"",$verbset[0],12); $html .= ''; } if($_POST['step']==='11' && ends($arrWord,array("gupa!","tija!","kita!"),4) ) diff --git a/scripts/function.php b/scripts/function.php index a9771ed..49269ba 100644 --- a/scripts/function.php +++ b/scripts/function.php @@ -2,7 +2,7 @@ /* This code is developed by Dr. Dhaval Patel (drdhaval2785@gmail.com) of www.sanskritworld.in and Ms. Sivakumari Katuri. * Layout assistance by Mr Marcis Gasuns. * Available under GNU licence. - * Version 1.1.2 date 7 November 2015 + * Version 1.6.0 date 21 February 2016 * The latest source code is available at https://github.com/drdhaval2785/SanskritVerb * For setup, copy and paste tiGanta.html, tiGanta.php, and scripts folder to your localhost and server and run tiGanta.html. * tiGanta.html is the frontend for the code. @@ -1386,7 +1386,7 @@ function ends($a,$b,$n) if ($debug===1){ echo "ends ", $n, " ended at "; timestamp();} - if (in_array(1,$can)) + if (isset($can) && in_array(1,$can)) { return true; // if any time $can becomes 1, it means that match is found. } @@ -1809,8 +1809,8 @@ function mit1($array,$b,$merge) /* Creating a function to fetch data from the verbdata variable */ // The function is almost ready. Now rename the variables so that it can be used. // $a = the input to take as base, $a1 = ref number of $a, $b = the thing to search. $c 1=whole list, 2=corresponding list. $d=additional field to be displayed, $e=additional condition, $e1= its ref no. -// Ref nos. 0=upadeza, 1=Meaning, 2=verb without anubandhas, 3=verbset, 4=number in dhatupatha, 5=Atmane/parasmai/ubhaya, 6=seT/aniT. 7. verb with accent 8.Set+number 9. Set name -// 0 to 7 are in the array. after that we process. +// Ref nos. 0=upadeza, 1=Meaning, 2=verb without anubandhas, 3=verbset, 4=number in dhatupatha, 5=Atmane/parasmai/ubhaya, 6=seT/aniT. 7. verb with accent. 8. mAdhavIyadhAtuvRtti. 9. kSIrataraGgiNI. 10. dhAtupradIpa. 11.Set+number. 12. Set name. +// 0 to 10 are in the array. after that we process. function scrape($a,$a1,$b,$c,$d,$e,$e1) { global $verbdata, $debug; @@ -1820,8 +1820,8 @@ function scrape($a,$a1,$b,$c,$d,$e,$e1) for($i=0;$i'.$commname.''; + } + } + else + { + $output[] = $errorname; + } + return implode(' , ',$output); +} // for ajax display in case the verb entered belongs to more than one gaNa. function verb_meaning_gana_number($text) { global $html; $verbaccent=scrape1($text,0,7,1); $meaning=scrape1($text,0,1,1); - $verbset=scrape1($text,0,9,1); - $number=scrape1($text,0,8,1); - $upadeza=scrape1($text,0,7,1); - - $html .= '
'; + $verbset=scrape1($text,0,12,1); + $number=scrape1($text,0,11,1); + $html .= '
'; for($i=0;$i '.$verbaccent[$i].' - '.convert($meaning[$i]).', '.convert($verbset[$i]).' '.$number[$i]; } $html .= '
'; -return $html; + return $html; } // for display in tiGanta.php function verb_meaning_gana_number1($text) @@ -1905,37 +1927,43 @@ function verb_meaning_gana_number1($text) global $frontend, $outfile; $verbaccent=scrape1($text,0,7,1); $meaning=scrape1($text,0,1,1); - $verbset=scrape1($text,0,9,1); - $number=scrape1($text,0,8,1); + $verbset=scrape1($text,0,12,1); + $madhav=scrape1($text,0,8,1); + $kzir=scrape1($text,0,9,1); + $dp=scrape1($text,0,10,1); + $number=scrape1($text,0,11,1); if ($frontend==='1') { - echo "

".toiast($verbaccent[0]).' - '.toiast($meaning[0]).', '.toiast($verbset[0]).' '.$number[0].' '."

\n"; - echo "

".$verbaccent[0].' - '.convert($meaning[0]).', '.convert($verbset[0]).' '.convert($number[0]).' '."

\n"; + echo "

".toiast($verbaccent[0]).' - '.toiast($meaning[0]).', '.toiast($verbset[0]).' '.$number[0]."

\n"; + echo "

".$verbaccent[0].' - '.convert($meaning[0]).', '.convert($verbset[0]).' '.convert($number[0]).', '.ldc($madhav[0],'m').', '.ldc($kzir[0],'k').', '.ldc($dp[0],'d')."

\n"; echo "
\n"; - fputs($outfile,"

".toiast($verbaccent[0]).' - '.toiast($meaning[0]).', '.toiast($verbset[0]).' '.$number[0].' '."

\n"); - fputs($outfile,"

".$verbaccent[0].' - '.convert($meaning[0]).', '.convert($verbset[0]).' '.convert($number[0]).' '."

\n"); + fputs($outfile,"

".toiast($verbaccent[0]).' - '.toiast($meaning[0]).', '.toiast($verbset[0]).' '.$number[0]."

\n"); + fputs($outfile,"

".$verbaccent[0].' - '.convert($meaning[0]).', '.convert($verbset[0]).' '.convert($number[0]).', '.ldc($madhav[0],'m').', '.ldc($kzir[0],'k').', '.ldc($dp[0],'d')."

\n"); fputs($outfile,"
\n"); } } // for display in tiGanta.php in case the user has chosen the gaNa. function verb_meaning_gana_number2($text) -{ +{ global $verbset, $frontend, $outfile; global $debug; if ($debug===1){ echo "verb_meaning_gana_number2 started at "; timestamp();} - $verbaccent=scrape($text,0,7,1,"",$verbset,9); - $meaning=scrape($text,0,1,1,"",$verbset,9); - $verbset1=scrape($text,0,9,1,"",$verbset,9); - $number=scrape($text,0,8,1,"",$verbset,9); + $verbaccent=scrape($text,0,7,1,"",$verbset,12); + $meaning=scrape($text,0,1,1,"",$verbset,12); + $verbset1=scrape($text,0,12,1,"",$verbset,12); + $madhav=scrape($text,0,8,1,"",$verbset,12); + $kzir=scrape($text,0,9,1,"",$verbset,12); + $dp=scrape($text,0,10,1,"",$verbset,12); + $number=scrape($text,0,11,1,"",$verbset,12); if ($frontend==='1') { - echo "

".toiast($verbaccent[0]).' - '.toiast($meaning[0]).', '.toiast($verbset1[0]).' '.$number[0].' '."

\n"; - echo "

".$verbaccent[0].' - '.convert($meaning[0]).', '.convert($verbset1[0]).' '.convert($number[0]).' '."

\n"; + echo "

".toiast($verbaccent[0]).' - '.toiast($meaning[0]).', '.toiast($verbset[0]).' '.$number[0]."

\n"; + echo "

".$verbaccent[0].' - '.convert($meaning[0]).', '.convert($verbset[0]).' '.convert($number[0]).', '.ldc($madhav[0],'m').', '.ldc($kzir[0],'k').', '.ldc($dp[0],'d')."

\n"; echo "
\n"; - fputs($outfile,"

".toiast($verbaccent[0]).' - '.toiast($meaning[0]).', '.toiast($verbset1[0]).' '.$number[0].' '."

\n"); - fputs($outfile,"

".$verbaccent[0].' - '.convert($meaning[0]).', '.convert($verbset1[0]).' '.convert($number[0]).' '."

\n"); + fputs($outfile,"

".toiast($verbaccent[0]).' - '.toiast($meaning[0]).', '.toiast($verbset[0]).' '.$number[0]."

\n"); + fputs($outfile,"

".$verbaccent[0].' - '.convert($meaning[0]).', '.convert($verbset[0]).' '.convert($number[0]).', '.ldc($madhav[0],'m').', '.ldc($kzir[0],'k').', '.ldc($dp[0],'d')."

\n"); fputs($outfile,"
\n"); } if ($debug===1){ @@ -1961,19 +1989,22 @@ function verb_meaning_gana_number4($number) { global $frontend, $outfile, $debug; if ($debug===1) {dibug("verb_meaning_gana_number4 start");} - $verbaccent=scrape1($number,8,7,1); - $meaning=scrape1($number,8,1,1); - $verbset=scrape1($number,8,9,1); - $number=scrape1($number,8,8,1); + $verbaccent=scrape1($number,11,7,1); + $meaning=scrape1($number,11,1,1); + $verbset=scrape1($number,11,12,1); + $madhav=scrape1($number,11,8,1); + $kzir=scrape1($number,11,9,1); + $dp=scrape1($number,11,10,1); + $number=scrape1($number,11,11,1); if ($debug===1) {dibug("verb_meaning_gana_number4 middle");} if ($frontend==='1') { - echo "

".toiast($verbaccent[0]).' - '.toiast($meaning[0]).', '.toiast($verbset[0]).' '.$number[0].' '."

\n"; - echo "

".$verbaccent[0].' - '.convert($meaning[0]).', '.convert($verbset[0]).' '.convert($number[0]).' '."

\n"; + echo "

".toiast($verbaccent[0]).' - '.toiast($meaning[0]).', '.toiast($verbset[0]).' '.$number[0]."

\n"; + echo "

".$verbaccent[0].' - '.convert($meaning[0]).', '.convert($verbset[0]).' '.convert($number[0]).', '.ldc($madhav[0],'m').', '.ldc($kzir[0],'k').', '.ldc($dp[0],'d')."

\n"; echo "
\n"; - fputs($outfile,"

".toiast($verbaccent[0]).' - '.toiast($meaning[0]).', '.toiast($verbset[0]).' '.$number[0].' '."

\n"); - fputs($outfile,"

".$verbaccent[0].' - '.convert($meaning[0]).', '.convert($verbset[0]).' '.convert($number[0]).' '."

\n"); - fputs($outfile,"
\n"); + /*fputs($outfile,"

".toiast($verbaccent[0]).' - '.toiast($meaning[0]).', '.toiast($verbset[0]).' '.$number[0]."

\n"); + fputs($outfile,"

".$verbaccent[0].' - '.convert($meaning[0]).', '.convert($verbset[0]).' '.convert($number[0]).', '.ldc($madhav[0],'m').', '.ldc($kzir[0],'k').', '.ldc($dp[0],'d')."

\n"); + fputs($outfile,"
\n");*/ } if ($debug===1) {dibug("verb_meaning_gana_number4 end");} } @@ -1987,7 +2018,7 @@ function dhatu_from_number($number) { global $frontend, $outfile, $debug; if ($debug===1) {dibug("dhatu_from_number start");} - $first=scrape1($number,8,0,1); + $first=scrape1($number,11,0,1); if ($debug===1) {dibug("dhatu_from_number end");} return $first[0]; } @@ -2030,18 +2061,18 @@ function suffix_display() else { echo "

".convert($lakAra) ." लकार
".convert($fo)." + ".convert($so)." Go Back

\n
\n"; - fputs($outfile,"

".convert($lakAra) ." लकार
".convert($fo)." + ".convert($so)." Go Back

\n
\n"); + //fputs($outfile,"

".convert($lakAra) ." लकार
".convert($fo)." + ".convert($so)." Go Back

\n
\n"); } } else { if ($sanAdi!=="") { - fputs($outfile,"

".convert($lakAra) ." लकार
".convert($fo)." + ".convert($sanAdi)." + ".convert($so)." Go Back

\n
\n
\n"); + //fputs($outfile,"

".convert($lakAra) ." लकार
".convert($fo)." + ".convert($sanAdi)." + ".convert($so)." Go Back

\n
\n
\n"); } else { - fputs($outfile,"

".convert($lakAra) ." लकार
".convert($fo)." + ".convert($so)." Go Back

\n
\n"); + //fputs($outfile,"

".convert($lakAra) ." लकार
".convert($fo)." + ".convert($so)." Go Back

\n
\n"); } } } @@ -2125,9 +2156,9 @@ function verb_suffixes($pada) function verb_padafinder($text) { /*global $verbset; - $verbpada=scrape($text,0,5,1,"",$verbset,9);*/ + $verbpada=scrape($text,0,5,1,"",$verbset,12);*/ global $number; - $verbpada = scrape1($number,8,5,1); + $verbpada = scrape1($number,11,5,1); $verbpada=array_unique($verbpada); $verbpada=array_values($verbpada); return $verbpada; @@ -2137,7 +2168,7 @@ function verb_itfinder($text) { global $verbset; global $fo; global $number; - $verb_it=scrape1($number,8,6,1); + $verb_it=scrape1($number,11,6,1); $verb_it=array_unique($verb_it); $verb_it=array_values($verb_it); return $verb_it; @@ -3295,9 +3326,9 @@ function gui2($sutra_number) echo "

By ".toiast($sutra_dev[$i])." (".link_sutra($sutra_number).") :

\n"; echo "

".$sutra_dev[$i]." (".convert($sutra_number).") :

\n"; echo "
"; - fputs($outfile,"

By ".toiast($sutra_dev[$i])." (".link_sutra($sutra_number).") :

\n"); + /*fputs($outfile,"

By ".toiast($sutra_dev[$i])." (".link_sutra($sutra_number).") :

\n"); fputs($outfile,"

".$sutra_dev[$i]." (".convert($sutra_number).") :

\n"); - fputs($outfile,"
"); + fputs($outfile,"
");*/ } } elseif (strpos($sutra_number,'-')!==false && strpos($sutra_number,'.')!==false && $frontend==='1') @@ -3329,9 +3360,9 @@ function gui2($sutra_number) echo "

By ".toiast($sutra_dev[$i])." :

\n"; echo "

".convert($sutra_dev[$i])." :

\n"; echo "
"; - fputs($outfile,"

By ".toiast($sutra_dev[$i])." :

\n"); + /*fputs($outfile,"

By ".toiast($sutra_dev[$i])." :

\n"); fputs($outfile,"

".convert($sutra_dev[$i])." :

\n"); - fputs($outfile,"
"); + fputs($outfile,"
");*/ } } } diff --git a/tiGanta.html b/tiGanta.html index 008e747..20b808b 100644 --- a/tiGanta.html +++ b/tiGanta.html @@ -105,7 +105,7 @@

Developed by: Dr. Dhaval Patel & Dr. Sivakumari Katuri.
Layout assistance by: Mr. Marcis Gasuns.
-Acknowledgements: This work is primarily based on Siddhantakaumudi. The work on tiGantaprakaraNa is primarily drawn from the works of Smt. Pushpa Deekshit. We also record our appreciation to Prof. Amba Kulkarni and Prof. Gerard Huet who have given their database of formed words so that we can compare our output against them.
+Acknowledgements: This work is primarily based on Siddhantakaumudi. The work on tiGantaprakaraNa is primarily drawn from the works of Smt. Pushpa Deekshit. We also record our appreciation to Prof. Amba Kulkarni and Prof. Gerard Huet who have given their database of formed words so that we can compare our output against them. We also acknowledge the loan of commentaries on dhAtupAThas by Prof. Amba Kulkarni.
Licence: Available under GNU licence.
Disclaimer: Despite our best efforts, intricacies of Sanskrit language may limit our machine. We owe no responsibility for wrong conjugation. User discretion is advised.
Correction submission: We will be greatful if you can send your corrections here.