Tryag File Manager
Home
-
Turbo Force
Current Path :
/
home
/
cluster1
/
data
/
bu01
/
1121861
/
html
/
xfst_dir_copy
/
Upload File :
New :
File
Dir
/home/cluster1/data/bu01/1121861/html/xfst_dir_copy/verb_forms.php4~
<html> <title>NLE:Verb Forms Parser</title> <link href="css/Verb_Forms.css" rel="stylesheet" type="text/css"> <script language="JavaScript"> function ShowMe(strSwitch){ if (strSwitch == "Inflections"){ if (document.getElementById('tblInflections').style.display=="none"){ document.getElementById('tblInflections').style.display= 'block'; document.getElementById('oInflectionsTitle').style.display= 'block'; window.resizeTo(400,700); }else{ document.getElementById('tblInflections').style.display= 'none'; document.getElementById('oInflectionsTitle').style.display= 'none'; window.resizeTo(400,250); } //}else{ //for senses when I know what they are } } </script> <body> <? include_once "utf8/utf8.class.php"; function get_root_verb($word) { $word = strtolower($word); //$word = utf8_encode($word); $utfConverter = new utf8(); $word = $utfConverter->strToUtf8($word); $xfst_path = "/spd25/htdocs/hyperlex2/nahuatl/xfst_dir/xfst -utf8 -e 'loadd SurfaceForms.fsm' -e 'regex GlSR;'"; $command = $xfst_path." -e 'apply up $word' -stop"; unset($parse); exec($command,$parse); //$result = utf8_decode(trim($parse[3])); $result = $utfConverter->utf8ToStr(trim($parse[3])); if($result != "") { $command = "/spd25/htdocs/hyperlex2/nahuatl/xfst_dir/xfst -utf8 -e 'loadd SurfaceForms.fsm'"; //$command = "xfst -utf8 -e 'loadd SurfaceForms.fsm'"; $command .= " -e 'regex GlUR;' -e 'apply down $result' -stop"; unset($parse); $foo = exec($command,$parse); $temp = $parse[3]; /* foreach($parse2 as $p) { echo utf8_decode($p)."<BR>"; } */ if($temp != "") { echo "<tr><td class=\"descriptor\">"; echo "Parse:</td><td class=\"value\"> $temp "; echo "</tr></td>"; } echo "<tr><td class=\"descriptor\">"; echo "Gloss:</td><td class=\"value\"> $result "; echo "</tr></td>"; $parts = explode("-",$result); $index = count($parts)-2; $results[0] = $parts[$index]; echo "<tr><td class=\"descriptor\">"; echo "Verb stem: </td><td class=\"value\"><a href='http://hyperlex2.ldc.upenn.edu/nahuatl/search_results.php4?user_lang=english&condition=word_search&word=".$results[0]."' target='dictionary'>".$results[0]."</A>"; echo "</tr></td>"; if($index == 1) { echo "<tr><td class=\"descriptor\">"; $results[1] = "intrans"; echo "Part of speech: </td><td class=\"value\">Intransitive Oapan verb"; echo "</tr></td>"; } else if($index == 2) { echo "<tr><td class=\"descriptor\">"; $results[1] = "trans"; echo "Part of speech: </td><td class=\"value\">Transitive Oapan verb"; echo "</tr></td>"; } return $results; } return ""; } function display_verb_table($word, $form) { $word = strtolower($word); $word = utf8_encode($word); $utfConverter = new utf8(); //defaults to CP1250. $word = $utfConverter->strToUtf8($word); $xfst_path = "/spd25/htdocs/hyperlex2/nahuatl/xfst_dir/xfst -utf8 -e 'loadd SurfaceForms.fsm' -e 'regex GlSR;'"; unset($table); $table = "<tr><td><b>Tense/Aspect</b></td><td><b>Singular</b></td><td><b>Plural</b></td></tr>"; if($form == "intrans") { $verb_table = "$xfst_path -e 'apply down 3sgS-".$word."-pres.sg'"; $verb_table .= " -e 'apply down 3plS-".$word."-pres.pl'"; $verb_table .= " -e 'apply down 3sgS-".$word."-fut.sg'"; $verb_table .= " -e 'apply down 3plS-".$word."-fut.pl'"; $verb_table .= " -e 'apply down 3sgS-".$word."-cond.sg'"; $verb_table .= " -e 'apply down 3plS-".$word."-cond.pl'"; $verb_table .= " -e 'apply down compl+3sgS-".$word."-perfv.sg'"; $verb_table .= " -e 'apply down compl+3plS-".$word."-perfv.pl'"; $verb_table .= " -e 'apply down compl+3sgS-".$word."-pluperfv.sg'"; $verb_table .= " -e 'apply down compl+3plS-".$word."-pluperfv.pl'"; $verb_table .= " -e 'apply down 3sgS-".$word."-imperfv.sg'"; $verb_table .= " -e 'apply down 3plS-".$word."-imperfv.pl'"; $verb_table .= " -e 'apply down opt= 3sgS-".$word."-opt.sg'"; $verb_table .= " -e 'apply down opt= 3plS-".$word."-opt.pl'"; $verb_table .= " -e 'apply down imp-".$word."-imp.sg'"; $verb_table .= " -e 'apply down imp-".$word."-imp.pl'"; $verb_table .= " -e 'apply down 3sgS-".$word."-dur.pres.sg'"; $verb_table .= " -e 'apply down 3plS-".$word."-dur.pres.pl'"; $verb_table .= " -e 'apply down 3sgS-".$word."-to.go.along.doing-pres.sg'"; $verb_table .= " -e 'apply down 3plS-".$word."-to.go.along.doing-pres.pl' -stop"; } else if ($form == "trans") { $verb_table = "$xfst_path -e 'apply down 3sgS-3sgO-".$word."-pres.sg'"; $verb_table .= " -e 'apply down 3plS-3sgO-".$word."-pres.pl'"; $verb_table .= " -e 'apply down 3sgS-3sgO-".$word."-fut.sg'"; $verb_table .= " -e 'apply down 3plS-3sgO-".$word."-fut.pl'"; $verb_table .= " -e 'apply down 3sgS-3sgO-".$word."-cond.sg'"; $verb_table .= " -e 'apply down 3plS-3sgO-".$word."-cond.pl'"; $verb_table .= " -e 'apply down compl+3sgS-3sgO-".$word."-perfv.sg'"; $verb_table .= " -e 'apply down compl+3plS-3sgO-".$word."-perfv.pl'"; $verb_table .= " -e 'apply down compl+3sgS-3sgO-".$word."-pluperfv.sg'"; $verb_table .= " -e 'apply down compl+3plS-3sgO-".$word."-pluperfv.pl'"; $verb_table .= " -e 'apply down 3sgS-3sgO-".$word."-imperfv.sg'"; $verb_table .= " -e 'apply down 3plS-3sgO-".$word."-imperfv.pl'"; $verb_table .= " -e 'apply down opt= 3sgS-3sgO-".$word."-opt.sg'"; $verb_table .= " -e 'apply down opt= 3plS-3sgO-".$word."-opt.pl'"; $verb_table .= " -e 'apply down imp-3sgO-".$word."-imp.sg'"; $verb_table .= " -e 'apply down imp-3sgO-".$word."-imp.pl'"; $verb_table .= " -e 'apply down 3sgS-3sgO-".$word."-dur.pres.sg'"; $verb_table .= " -e 'apply down 3plS-3sgO-".$word."-dur.pres.pl'"; $verb_table .= " -e 'apply down 3sgS-3sgO-".$word."-to.go.along.doing-pres.sg'"; $verb_table .= " -e 'apply down 3plS-3sgO-".$word."-to.go.along.doing-pres.pl' -stop"; } else { die("<BR>For the moment, a verb table can not be generated from this page. Please click on root verb and generate the inflectional table directly from the dictionary entry.<BR>"); } unset($parse); exec($verb_table,$parse); while(list($key,$val) = each($parse)) { //$parse[$key] = utf8_decode($val); $parse[$key] = $utfConverter->utf8ToStr($val); } /* $table .= "<tr><td>Present</td><td>".$parse[1]."</td><td>".$parse[2]."</td><tr>"; $table .= "<tr><td>Future</td><td>".$parse[3]."</td><td>".$parse[4]."</td><tr>"; $table .= "<tr><td>Conditional</td><td>".$parse[5]."</td><td>".$parse[7]."</td><tr>"; $table .= "<tr><td>Conditional</td><td>".$parse[6]."</td><td>".$parse[8]."</td><tr>"; $table .= "<tr><td>Perfective</td><td>".$parse[9]."</td><td>".$parse[10]."</td><tr>"; $table .= "<tr><td>Pluperfective</td><td>".$parse[11]."</td><td>".$parse[12]."</td><tr>"; $table .= "<tr><td>Imperfective</td><td>".$parse[13]."</td><td>".$parse[14]."</td><tr>"; $table .= "<tr><td>Optative</td><td>".$parse[15]."</td><td>".$parse[16]."</td><tr>"; $table .= "<tr><td>Imperative</td><td>".$parse[17]."</td><td>".$parse[18]."</td><tr>"; $table .= "<tr><td>Durative</td><td>".$parse[19]."</td><td>".$parse[20]."</td><tr>"; $table .= "<tr><td>Associated Motion</td><td>".$parse[21]."</td><td>".$parse[22]."</td><tr>"; */ $table .= "<tr><td>Present</td><td>".$parse[3]."</td><td>".$parse[4]."</td><tr>"; $table .= "<tr><td>Future</td><td>".$parse[5]."</td><td>".$parse[6]." <i>or</i> ".$parse[7]."</td><tr>"; $table .= "<tr><td>Conditional</td><td>".$parse[8]."<i> or </i>".$parse[9]; $table .= "</td><td>".$parse[10]."<i> or </i>".$parse[11]."</td><tr>"; $table .= "<tr><td>Perfective</td><td>".$parse[12]."</td><td>".$parse[13]."</td><tr>"; $table .= "<tr><td>Pluperfective</td><td>".$parse[14]."</td><td>".$parse[15]."</td><tr>"; $table .= "<tr><td>Imperfective</td><td>".$parse[16]."</td><td>".$parse[17]."</td><tr>"; $table .= "<tr><td>Optative</td><td>".$parse[18]."</td><td>".$parse[19]."</td><tr>"; $table .= "<tr><td>Imperative</td><td>".$parse[20]."</td><td>".$parse[21]."</td><tr>"; $table .= "<tr><td>Durative</td><td>".$parse[22]."<i> or </i> ".$parse[23]."</td><td>".$parse[24]."<i> or </i> ".$parse[25]."</td><tr>"; $table .= "<tr><td>Associated Motion</td><td>".$parse[26]."</td><td>".$parse[27]."<i> or </i> ".$parse[28]."</td>"; echo "<BR>"; echo "<div id=\"oInflectionsTitle\" style=\"display:none;\"><b>Oapan verb inflections</b></div>"; echo "<BR><BR>"; echo "<table class=\"tblInflections\" id=\"tblInflections\" style=\"display:none;\" border='1' cellpadding='3' cellspacing='3'>"; echo $table; echo "</table>"; } /**************************** MAIN *************************/ if($condition == "story") { $word = strtolower($word); if(ereg("Am",$dialect)) { //$lxa = $word; //FOR NOW: $lxo = $word; } else if(ereg("Oa",$dialect)) { $lxo = $word; } $word = $lxo; echo "<table class=\"tblVerb\" border = \"1\" cellpadding=\"3\" cellspaceing=\"3\">"; echo "<tr><td class=\"descriptor\">"; echo "Word: </td><td class=\"value\">$word <BR>"; echo "</tr></td>"; $root_info = get_root_verb($word); echo "</table>"; echo "<br>Click to show/hide: <a href = \"javascript:ShowMe('Inflections');\">inflections</a><br>"; if($root_info == "") { $xfst_path = "/spd25/htdocs/hyperlex2/nahuatl/xfst_dir/xfst -utf8 -e 'loadd SurfaceForms.fsm' -e 'regex GlSR;'"; $command = "$xfst_path -e 'apply down 3sgS-3sgO-".$word."-pres.sg' -stop"; unset($parse); $result = trim(exec($command,$parse)); if($result != "") { echo "<BR>Oh my God, this may be a transitive verb! If the query did not include an object prefix, please try resubmitting with an object prefix. <BR><BR>If the query did contain a correct object prefix, then this verb is most likely an irregular verb that still does not parse.<BR>"; } else { die("This word can not be parsed."); } } else { display_verb_table($root_info[0],$root_info[1]); } } else { $words = strtolower($words); $words = explode("_",$words); $lxa = $words[0]; $lxo = $words[1]; //FOR NOW.... $word = $lxo; if(trim($form) == "") { $HOST = "wave.ldc.upenn.edu"; $USER = "hyperlex"; $PASSWORD = "jota"; $DATABASE = "hyperlex"; $TABLE = "nahuatl"; @ $db = mysql_pconnect($HOST, $USER, $PASSWORD); if(!$db) { echo "Error: Could not connect to database. Please try again later."; exit; } mysql_select_db($DATABASE); $query = "SELECT psm FROM $TABLE WHERE lxo='$word'"; $query_result = mysql_query($query); if(mysql_num_rows($query_result) == 0) { die("$lxo is not in the lexicon."); } $row = mysql_fetch_assoc($query_result); $psm = $row["psm"]; echo "PSM: $psm <BR>"; if(ereg("V0|V1",$psm)) { $form = "intrans"; } else if(ereg("V2|V3",$psm)) { $form = "trans"; } else { die("$lxo can not be parsed. Part of speech is $psm. Must have part of speech V0, V1, V2, or V3."); } } echo "<BODY onload='window.focus()'>"; display_verb_table($word,$form); echo "</BODY>"; } ?> </body> </html>