Tryag File Manager
Home
-
Turbo Force
Current Path :
/
home
/
cluster1
/
data
/
bu01
/
1121861
/
html
/
Books-on-demand
/
Upload File :
New :
File
Dir
/home/cluster1/data/bu01/1121861/html/Books-on-demand/find_verbs_lg.php
<? //include "verb_forms.php4"; include_once "utf8/utf8.class.php"; $xfst_path = "/spd25/htdocs/hyperlex2/nahuatl/xfst_dir/xfst -utf8 -q -e 'loadd SurfaceForms.fsm' -e 'regex GlSR;'"; $in = file("Teel_lg.htm"); unset($words); $verbs = array(); $commands = $xfst_path; 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("Teel_lg.htm"); $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 = $newLink . " onmouseover=\""; $newLink = $newLink . "return overlib('" . getVerbSenses($v) . "',STICKY,TIMEOUT,10000);\""; $newLink = $newLink . " onmouseout=\"return nd();\" >$v</A>"; //$other = getVerbSenses($v); $s = ereg_replace($v,$newLink,$s); } $out = fopen("Teel_with_links_lg.html","w"); fwrite($out,$s); fclose($out); function GetVerbSenses($word){ { $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 != "") { $table = "<table><tr><td>"; $table = $table . "<b>Parse</b>:</td><td> $temp "; $table = $table . "</tr></td>"; } $table = $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]; $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>"; } return $table; } return ""; } } ?>