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/find_verbs_lg3.php
<HTML> <body> <form name="form1" method="post" action="find_verbs_lg3.php"> <p>Input file: <input name="inputFile" type="text" id="inputFile" size="80"> </p> <p>Output file: <input name="outputFile" type="text" id="outputFile" size="80"> </p> <p> <input type="submit" name="Submit" value="Submit"> </p> </form> </body> <? //include "verb_forms.php4"; include_once "utf8/utf8.class.php"; $inputfile = $_REQUEST['inputFile']; $outputfile = $_REQUEST['outputFile']; $xfst_path = "/spd25/htdocs/hyperlex2/nahuatl/xfst_dir/xfst -utf8 -q -e 'loadd SurfaceForms.fsm' -e 'regex GlSR;'"; //$in = file("Burroh.html"); $in = file($inputfile); unset($words); $verbs = array(); $commands = $xfst_path; $verbStem; foreach($in as $line) { $line = strtolower($line); $line = utf8_encode($line); $line = ereg_replace("[.?,;']","",$line); $line = explode(" ",$line); foreach($line as $word) { $word = trim($word); if(($word != "") && !ereg("=|[0-9]|Roman",$word)){ $word = ereg_replace("<.*>","",$word); $word = ereg_replace("[<>|{]","",$word); $commands .= " -e 'apply up $word'"; } } } $commands .= " -stop"; unset($parsable); exec($commands,$parsable); $commands = $xfst_path; foreach($parsable as $p) { $commands .= " -e 'apply down $p'"; } $commands .= " -stop"; unset($verbs); exec($commands,$verbs); sort($verbs); $verbs = array_unique($verbs); /* foreach($verbs as $v) { echo "$v <BR>"; } */ //$in = file("Burroh.html"); $in = file($inputfile); $s = ""; foreach($in as $line) { $s .= $line; } $newLink = ""; $other=""; foreach($verbs as $v) { $v = utf8_decode($v); //$s = ereg_replace($v,"<A href='http://wave.ldc.upenn.edu/hyperlex2/nahuatl/xfst_dir/verb_forms.php4?condition=story&dialect=Oa&word=$v' target='parser'>$v</A>",$s); //$newLink = " <A href='http://wave.ldc.upenn.edu/hyperlex2/nahuatl/xfst_dir/verb_forms.php4?condition=story&dialect=Oa&word=$v' target='parser' "; $newLink = "<A target='parser' href=\"javascript:void(0);\" "; $newLink = $newLink . " onclick=\""; $newLink = $newLink . "javascript:return overlib('" . getVerbParse($v,"standard") . GetSenses($v) . "',STICKY,RELY,0,RELX,(screen.width-500),HEIGHT,700,WIDTH,470,CAPTION,'NLE',CLOSECLICK);\""; $newLink = $newLink . " onmouseover=\""; $newLink = $newLink . "javascript:return overlib('" . getVerbParse($v,"popup") . "',HAUTO,VAUTO,WIDTH,225,CAPTION,'NLE',TEXTSIZE,'XX-SMALL',CLOSECLICK);\""; $newLink = $newLink . " onmouseout=\"return nd();\" >$v</A>"; //$other = getVerbSenses($v); $s = ereg_replace($v,$newLink,$s); } echo "writing to $outputfile"; //" " and $ //$out = fopen("Burroh_with_links_lg.html","w"); $out = fopen($outputfile,"w"); fwrite($out,$s); fclose($out); //echo "<a href=\"Burroh_with_links_lg.html\" target=\"_blank\">; function GetSenses($word){ global $verbStem; $urltoSenses = "http://hyperlex2.ldc.upenn.edu/nahuatl/search_results.php4?user_lang=english&condition=word_search&word=".$verbStem."&entry_template=englishwordsense.html&bg_template=english%senses_template.html"; $strIframe = htmlentities ("<tr><td colspan=\"2\"><div id=\"Layer1\" style=\"z-index:1;\"><iframe style=\"scrollbar-base-color:#FFFFcc;\" width = \"98%\" height=\"98%\" align = \"left\" src=\"$urltoSenses\" scrolling=\"yes\" frameborder=\"0\" ></iframe></div></td></tr></table>"); return $strIframe; } function GetVerbParse($word,$type){ { global $verbStem; $table = ""; $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 != "") { if($type=="standard"){ $table = "<table class=standard><tr><td>"; }else{ $table = '<table class=popuptable><tr><td>'; } $table = $table . "<b>Parse</b>:</td><td> $temp "; $table = $table . "</tr></td>"; } //$table = $table . "<table><tr><td>"; $table = $table . "<tr><td>"; $table = $table . "<b>Gloss</b>:</td><td > $result "; $table = $table . "</tr></td>"; $parts = explode("-",$result); $index = count($parts)-2; $results[0] = $parts[$index]; $verbStem = $results[0]; $table = $table . "<tr><td>"; $table = $table . "<b>Verb stem</b>:</td><td>"; $table = $table . "<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>"; $table = $table . "</tr></td>"; if($index == 1) { $table = $table . "<tr><td>"; $results[1] = "intrans"; $table = $table . "<b>Part of speech</b>: </td><td>Intransitive Oapan verb"; $table = $table . "</tr></td>"; } else if($index == 2) { $table = $table . "<tr><td>"; $results[1] = "trans"; $table = $table . "<b>Part of speech</b>: </td><td>Transitive Oapan verb"; //$table = $table . "</tr></td></table>"; $table = $table . "</tr></td>"; } $table = $table . "</table>"; return $table; } return ""; } } ?> </HTML>